Citus indent

velioglu/wo_seq_test_1
Burak Velioglu 2021-12-28 12:48:20 +03:00
parent e610a147a1
commit cc68e87903
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
7 changed files with 31 additions and 28 deletions

View File

@ -1354,8 +1354,8 @@ ReplaceTable(Oid sourceId, Oid targetId, List *justBeforeDropCommands,
changeDependencyFor(RelationRelationId, sequenceOid, changeDependencyFor(RelationRelationId, sequenceOid,
RelationRelationId, sourceId, targetId); RelationRelationId, sourceId, targetId);
// Changing the dependency for sequence will prevent PG to have /* Changing the dependency for sequence will prevent PG to have */
// sequence within drop trigger /* sequence within drop trigger */
if (conversionType == UNDISTRIBUTE_TABLE) if (conversionType == UNDISTRIBUTE_TABLE)
{ {
ObjectAddress sequenceAddress = { 0 }; ObjectAddress sequenceAddress = { 0 };

View File

@ -1250,7 +1250,7 @@ FinalizeCitusLocalTableCreation(Oid relationId, List *dependentSequenceList)
} }
else else
{ {
// Mark the table as distributed only locally /* Mark the table as distributed only locally */
bool prevDependencyCreationValue = EnableDependencyCreation; bool prevDependencyCreationValue = EnableDependencyCreation;
SetLocalEnableDependencyCreation(false); SetLocalEnableDependencyCreation(false);
MarkObjectDistributed(&relationAddress); MarkObjectDistributed(&relationAddress);

View File

@ -540,7 +540,7 @@ CreateDistributedTable(Oid relationId, Var *distributionColumn, char distributio
} }
else else
{ {
// Mark the table as distributed only locally /* Mark the table as distributed only locally */
bool prevDependencyCreationValue = EnableDependencyCreation; bool prevDependencyCreationValue = EnableDependencyCreation;
SetLocalEnableDependencyCreation(false); SetLocalEnableDependencyCreation(false);
MarkObjectDistributed(&tableAddress); MarkObjectDistributed(&tableAddress);

View File

@ -242,7 +242,7 @@ GetDependencyCreateDDLCommands(const ObjectAddress *dependency)
if (IsCitusTable(relationId) && !IsTableOwnedByExtension(relationId)) if (IsCitusTable(relationId) && !IsTableOwnedByExtension(relationId))
{ {
/* 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 */
// TODO: Check sequence next val type /* TODO: Check sequence next val type */
List *commandList = NIL; List *commandList = NIL;
List *tableDDLCommands = GetFullTableCreationCommands(relationId, List *tableDDLCommands = GetFullTableCreationCommands(relationId,
WORKER_NEXTVAL_SEQUENCE_DEFAULTS); WORKER_NEXTVAL_SEQUENCE_DEFAULTS);
@ -266,7 +266,7 @@ GetDependencyCreateDDLCommands(const ObjectAddress *dependency)
if (relKind == RELKIND_SEQUENCE) if (relKind == RELKIND_SEQUENCE)
{ {
// TODO: Check user name for different scenarios /* TODO: Check user name for different scenarios */
char *userName = GetUserNameFromId(GetUserId(), false); char *userName = GetUserNameFromId(GetUserId(), false);
return DDLCommandsForSequence(dependency->objectId, userName); return DDLCommandsForSequence(dependency->objectId, userName);
} }
@ -403,7 +403,8 @@ 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);
SendCommandListToWorkerOutsideTransaction(nodeName, nodePort, CitusExtensionOwnerName(), ddlCommands); SendCommandListToWorkerOutsideTransaction(nodeName, nodePort,
CitusExtensionOwnerName(), ddlCommands);
} }

View File

@ -823,12 +823,13 @@ ClearDistributedTablesFromNode(WorkerNode *workerNode)
List *clearDistributedTablesCommandList = NIL; List *clearDistributedTablesCommandList = NIL;
clearDistributedTablesCommandList = lappend(clearDistributedTablesCommandList, clearDistributedTablesCommandList = lappend(clearDistributedTablesCommandList,
REMOVE_ALL_CLUSTERED_TABLES_ONLY_COMMAND); REMOVE_ALL_CLUSTERED_TABLES_ONLY_COMMAND);
clearDistributedTablesCommandList = list_concat(list_make1(DISABLE_DDL_PROPAGATION), clearDistributedTablesCommandList = list_concat(list_make1(DISABLE_DDL_PROPAGATION),
clearDistributedTablesCommandList); clearDistributedTablesCommandList);
clearDistributedTablesCommandList = list_concat(clearDistributedTablesCommandList, list_make1( clearDistributedTablesCommandList = list_concat(clearDistributedTablesCommandList,
ENABLE_DDL_PROPAGATION)); list_make1(
ENABLE_DDL_PROPAGATION));
SendCommandListToWorkerOutsideTransaction(workerNode->workerName, SendCommandListToWorkerOutsideTransaction(workerNode->workerName,
workerNode->workerPort, workerNode->workerPort,
@ -850,7 +851,7 @@ ClearDistributedObjectsAndIntegrationsFromNode(WorkerNode *workerNode)
detachPartitionCommandList); detachPartitionCommandList);
clearDistTableInfoCommandList = lappend(clearDistTableInfoCommandList, clearDistTableInfoCommandList = lappend(clearDistTableInfoCommandList,
REMOVE_ALL_CLUSTERED_TABLES_METADATA_ONLY_COMMAND); REMOVE_ALL_CLUSTERED_TABLES_METADATA_ONLY_COMMAND);
clearDistTableInfoCommandList = lappend(clearDistTableInfoCommandList, clearDistTableInfoCommandList = lappend(clearDistTableInfoCommandList,
DELETE_ALL_DISTRIBUTED_OBJECTS); DELETE_ALL_DISTRIBUTED_OBJECTS);
@ -862,9 +863,9 @@ ClearDistributedObjectsAndIntegrationsFromNode(WorkerNode *workerNode)
char *currentUser = CurrentUserName(); char *currentUser = CurrentUserName();
SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName, SendMetadataCommandListToWorkerInCoordinatedTransaction(workerNode->workerName,
workerNode->workerPort, workerNode->workerPort,
currentUser, currentUser,
clearDistTableInfoCommandList); clearDistTableInfoCommandList);
} }
@ -906,14 +907,15 @@ SetUpDistributedTableWithDependencies(WorkerNode *newWorkerNode)
* We prefer this because otherwise node activation might fail within * We prefer this because otherwise node activation might fail within
* transaction blocks. * transaction blocks.
*/ */
// TODO: Doesn't make sense to have that here as we won't handle placement metadata /* TODO: Doesn't make sense to have that here as we won't handle placement metadata */
// with maintenance daemon anymore /* with maintenance daemon anymore */
/* if (ClusterHasDistributedFunctionWithDistArgument()) /* if (ClusterHasDistributedFunctionWithDistArgument())
{ * {
SetWorkerColumnLocalOnly(newWorkerNode, Anum_pg_dist_node_hasmetadata, * SetWorkerColumnLocalOnly(newWorkerNode, Anum_pg_dist_node_hasmetadata,
BoolGetDatum(true)); * BoolGetDatum(true));
TriggerMetadataSyncOnCommit(); * TriggerMetadataSyncOnCommit();
}*/ * }*/
} }
} }
@ -1191,9 +1193,9 @@ ActivateNode(char *nodeName, int nodePort)
} }
/* /*
* Delete replicated table placements from the coordinator's metadata, * Delete replicated table placements from the coordinator's metadata,
* including remote ones. * including remote ones.
*/ */
bool forceRemoteDelete = true; bool forceRemoteDelete = true;
DeleteAllReplicatedTablePlacementsFromNodeGroup(workerNode->groupId, DeleteAllReplicatedTablePlacementsFromNodeGroup(workerNode->groupId,
forceRemoteDelete); forceRemoteDelete);

View File

@ -539,7 +539,7 @@ ReferenceTableReplicationFactor(void)
* table to update the replication factor column when necessary. This function * table to update the replication factor column when necessary. This function
* skips reference tables if that node already has healthy placement of that * skips reference tables if that node already has healthy placement of that
* reference table to prevent unnecessary data transfer. * reference table to prevent unnecessary data transfer.
* *
* TODO: Make is static and updatr comment * TODO: Make is static and updatr comment
*/ */
void void

View File

@ -249,7 +249,7 @@ worker_drop_distributed_table_only(PG_FUNCTION_ARGS)
/* /*
* worker_drop_distributed_table_metadata_only removes the associated rows from pg_dist_partition, * worker_drop_distributed_table_metadata_only removes the associated rows from pg_dist_partition,
* pg_dist_shard and pg_dist_placement for the given relation. * pg_dist_shard and pg_dist_placement for the given relation.
*/ */
Datum Datum
@ -283,4 +283,4 @@ worker_drop_distributed_table_metadata_only(PG_FUNCTION_ARGS)
DeletePartitionRow(relationId); DeletePartitionRow(relationId);
PG_RETURN_VOID(); PG_RETURN_VOID();
} }