Indentation fix

velioglu/wo_seq_test_1
Burak Velioglu 2021-12-20 12:30:36 +03:00
parent 303c7e230e
commit ab29b939b2
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
4 changed files with 50 additions and 31 deletions

View File

@ -64,7 +64,8 @@ EnsureDependenciesExistOnAllNodes(const ObjectAddress *target)
List *dependencyCommands = GetDependencyCreateDDLCommands(dependency); List *dependencyCommands = GetDependencyCreateDDLCommands(dependency);
ddlCommands = list_concat(ddlCommands, dependencyCommands); ddlCommands = list_concat(ddlCommands, dependencyCommands);
// TODO: Might add check for tables /* TODO: Might add check for tables */
/* create a new list with dependencies that actually created commands */ /* create a new list with dependencies that actually created commands */
if (list_length(dependencyCommands) > 0) if (list_length(dependencyCommands) > 0)
{ {
@ -243,17 +244,20 @@ GetDependencyCreateDDLCommands(const ObjectAddress *dependency)
{ {
/* skip table metadata creation when the Citus table is owned by an extension */ /* skip table metadata creation when the Citus table is owned by an extension */
List *commandList = NIL; List *commandList = NIL;
List *tableDDLCommands = GetFullTableCreationCommands(relationId, WORKER_NEXTVAL_SEQUENCE_DEFAULTS); List *tableDDLCommands = GetFullTableCreationCommands(relationId,
WORKER_NEXTVAL_SEQUENCE_DEFAULTS);
TableDDLCommand *tableDDLCommand = NULL; TableDDLCommand *tableDDLCommand = NULL;
foreach_ptr(tableDDLCommand, tableDDLCommands) foreach_ptr(tableDDLCommand, tableDDLCommands)
{ {
Assert(CitusIsA(tableDDLCommand, TableDDLCommand)); Assert(CitusIsA(tableDDLCommand, TableDDLCommand));
commandList = lappend(commandList, GetTableDDLCommand(tableDDLCommand)); commandList = lappend(commandList, GetTableDDLCommand(
tableDDLCommand));
} }
// TODO: May need to move sequence dependencies to ActiveNode directly /* TODO: May need to move sequence dependencies to ActiveNode directly */
List *sequenceDependencyCommandList = SequenceDependencyCommandList(dependency->objectId); List *sequenceDependencyCommandList = SequenceDependencyCommandList(
dependency->objectId);
commandList = list_concat(commandList, sequenceDependencyCommandList); commandList = list_concat(commandList, sequenceDependencyCommandList);
return commandList; return commandList;
@ -265,6 +269,9 @@ GetDependencyCreateDDLCommands(const ObjectAddress *dependency)
char *userName = GetUserNameFromId(GetUserId(), false); char *userName = GetUserNameFromId(GetUserId(), false);
return DDLCommandsForSequence(dependency->objectId, userName); return DDLCommandsForSequence(dependency->objectId, userName);
} }
/* if this relation is not supported, break to the error at the end */
break;
} }
case OCLASS_COLLATION: case OCLASS_COLLATION:
@ -395,7 +402,9 @@ ReplicateAllDependenciesToNode(const char *nodeName, int nodePort)
ddlCommands = lcons(DISABLE_DDL_PROPAGATION, ddlCommands); ddlCommands = lcons(DISABLE_DDL_PROPAGATION, ddlCommands);
ddlCommands = lappend(ddlCommands, ENABLE_DDL_PROPAGATION); ddlCommands = lappend(ddlCommands, ENABLE_DDL_PROPAGATION);
SendMetadataCommandListToWorkerInCoordinatedTransaction(nodeName, nodePort, CitusExtensionOwnerName(), ddlCommands); SendMetadataCommandListToWorkerInCoordinatedTransaction(nodeName, nodePort,
CitusExtensionOwnerName(),
ddlCommands);
} }

View File

@ -677,11 +677,13 @@ SupportedDependencyByCitus(const ObjectAddress *address)
*/ */
if (relKind == RELKIND_COMPOSITE_TYPE || if (relKind == RELKIND_COMPOSITE_TYPE ||
relKind == RELKIND_RELATION || relKind == RELKIND_RELATION ||
relKind == RELKIND_PARTITIONED_TABLE || // TODO: Should check for normal tables? relKind == RELKIND_PARTITIONED_TABLE || /* TODO: Should check for normal tables? */
relKind == RELKIND_SEQUENCE) relKind == RELKIND_SEQUENCE)
{ {
return true; return true;
} }
return false;
} }
default: default:

View File

@ -1819,7 +1819,6 @@ CreateTableMetadataOnWorkers(Oid relationId)
} }
/* /*
* SyncMetadataToNodes tries recreating the metadata snapshot in the * SyncMetadataToNodes tries recreating the metadata snapshot in the
* metadata workers that are out of sync. Returns the result of * metadata workers that are out of sync. Returns the result of

View File

@ -248,7 +248,7 @@ citus_add_node(PG_FUNCTION_ARGS)
if (!EnableDependencyCreation) if (!EnableDependencyCreation)
{ {
ereport(ERROR, (errmsg("citus.enable_object_propagation must be on to " ereport(ERROR, (errmsg("citus.enable_object_propagation must be on to "
"add node"))); "add node")));
} }
/* /*
@ -592,10 +592,10 @@ master_set_node_property(PG_FUNCTION_ARGS)
/* /*
* SetUpMultipleDistributedTableIntegrations set up the multiple integrations * SetUpMultipleDistributedTableIntegrations set up the multiple integrations
* including * including
* *
* (i) Foreign keys * (i) Foreign keys
* (ii) Partionining hierarchy * (ii) Partionining hierarchy
* *
* on the given worker node. * on the given worker node.
*/ */
static void static void
@ -656,8 +656,10 @@ SetUpMultipleDistributedTableIntegrations(WorkerNode *workerNode)
} }
char *currentUser = CurrentUserName(); char *currentUser = CurrentUserName();
multipleTableIntegrationCommandList = lcons(DISABLE_DDL_PROPAGATION, multipleTableIntegrationCommandList); multipleTableIntegrationCommandList = lcons(DISABLE_DDL_PROPAGATION,
multipleTableIntegrationCommandList = lappend(multipleTableIntegrationCommandList, ENABLE_DDL_PROPAGATION); multipleTableIntegrationCommandList);
multipleTableIntegrationCommandList = lappend(multipleTableIntegrationCommandList,
ENABLE_DDL_PROPAGATION);
SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName, SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName,
workerNode->workerPort, workerNode->workerPort,
currentUser, currentUser,
@ -719,8 +721,10 @@ SetUpObjectMetadata(WorkerNode *workerNode)
distributedObjectSyncCommandList); distributedObjectSyncCommandList);
} }
metadataSnapshotCommandList = lcons(DISABLE_DDL_PROPAGATION, metadataSnapshotCommandList); metadataSnapshotCommandList = lcons(DISABLE_DDL_PROPAGATION,
metadataSnapshotCommandList = lappend(metadataSnapshotCommandList, ENABLE_DDL_PROPAGATION); metadataSnapshotCommandList);
metadataSnapshotCommandList = lappend(metadataSnapshotCommandList,
ENABLE_DDL_PROPAGATION);
char *currentUser = CurrentUserName(); char *currentUser = CurrentUserName();
SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName, SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName,
@ -830,15 +834,18 @@ ClearDistributedObjectsWithMetadataFromNode(WorkerNode *workerNode)
List *detachPartitionCommandList = DetachPartitionCommandList(); List *detachPartitionCommandList = DetachPartitionCommandList();
clearDistTableInfoCommandList = list_concat(clearDistTableInfoCommandList, clearDistTableInfoCommandList = list_concat(clearDistTableInfoCommandList,
detachPartitionCommandList); detachPartitionCommandList);
clearDistTableInfoCommandList = lappend(clearDistTableInfoCommandList, clearDistTableInfoCommandList = lappend(clearDistTableInfoCommandList,
REMOVE_ALL_CLUSTERED_TABLES_COMMAND); REMOVE_ALL_CLUSTERED_TABLES_COMMAND);
clearDistTableInfoCommandList = lappend(clearDistTableInfoCommandList, DELETE_ALL_DISTRIBUTED_OBJECTS); clearDistTableInfoCommandList = lappend(clearDistTableInfoCommandList,
DELETE_ALL_DISTRIBUTED_OBJECTS);
clearDistTableInfoCommandList = list_concat(list_make1(DISABLE_DDL_PROPAGATION),clearDistTableInfoCommandList); clearDistTableInfoCommandList = list_concat(list_make1(DISABLE_DDL_PROPAGATION),
clearDistTableInfoCommandList = list_concat(clearDistTableInfoCommandList, list_make1(ENABLE_DDL_PROPAGATION)); clearDistTableInfoCommandList);
clearDistTableInfoCommandList = list_concat(clearDistTableInfoCommandList, list_make1(
ENABLE_DDL_PROPAGATION));
char *currentUser = CurrentUserName(); char *currentUser = CurrentUserName();
SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName, SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName,
@ -932,9 +939,9 @@ PropagateNodeWideObjects(WorkerNode *newWorkerNode)
/* send commands to new workers*/ /* send commands to new workers*/
SendMetadataCommandListToWorkerInCoordinatedTransaction(newWorkerNode->workerName, SendMetadataCommandListToWorkerInCoordinatedTransaction(newWorkerNode->workerName,
newWorkerNode->workerPort, newWorkerNode->workerPort,
CitusExtensionOwnerName(), CitusExtensionOwnerName(),
ddlCommands); ddlCommands);
} }
} }
@ -975,7 +982,7 @@ citus_activate_node(PG_FUNCTION_ARGS)
if (!EnableDependencyCreation) if (!EnableDependencyCreation)
{ {
ereport(ERROR, (errmsg("citus.enable_object_propagation must be on to " ereport(ERROR, (errmsg("citus.enable_object_propagation must be on to "
"activate node"))); "activate node")));
} }
WorkerNode *workerNode = ModifiableWorkerNode(text_to_cstring(nodeNameText), WorkerNode *workerNode = ModifiableWorkerNode(text_to_cstring(nodeNameText),
@ -1179,14 +1186,14 @@ ActivateNode(char *nodeName, int nodePort)
{ {
StartMetadataSyncToNode(nodeName, nodePort); StartMetadataSyncToNode(nodeName, nodePort);
/* /*
* Since coordinator node already has both objects and related metadata * Since coordinator node already has both objects and related metadata
* we don't need to recreate them. * we don't need to recreate them.
*/ */
if (workerNode->groupId != COORDINATOR_GROUP_ID) if (workerNode->groupId != COORDINATOR_GROUP_ID)
{ {
// TODO: Consider calling function below according to other states like primary/secondary /* TODO: Consider calling function below according to other states like primary/secondary */
// Should we check syncMetadata always on as well? /* Should we check syncMetadata always on as well? */
ClearDistributedObjectsWithMetadataFromNode(workerNode); ClearDistributedObjectsWithMetadataFromNode(workerNode);
SetUpDistributedTableWithDependencies(workerNode); SetUpDistributedTableWithDependencies(workerNode);
SetUpMultipleDistributedTableIntegrations(workerNode); SetUpMultipleDistributedTableIntegrations(workerNode);
@ -1206,6 +1213,7 @@ ActivateNode(char *nodeName, int nodePort)
return newWorkerNode->nodeId; return newWorkerNode->nodeId;
} }
/* /*
* DetachPartitionCommandList returns list of DETACH commands to detach partitions * DetachPartitionCommandList returns list of DETACH commands to detach partitions
* of all distributed tables. This function is used for detaching partitions in MX * of all distributed tables. This function is used for detaching partitions in MX
@ -1242,7 +1250,8 @@ DetachPartitionCommandList(void)
return NIL; return NIL;
} }
detachPartitionCommandList = lcons(DISABLE_DDL_PROPAGATION, detachPartitionCommandList); detachPartitionCommandList = lcons(DISABLE_DDL_PROPAGATION,
detachPartitionCommandList);
/* /*
* We probably do not need this but as an extra precaution, we are enabling * We probably do not need this but as an extra precaution, we are enabling