Second commit to change APIs

metadata_sync_imp
Onder Kalaci 2022-11-28 09:50:22 +01:00
parent db9cebf295
commit 3f72a6c1d2
3 changed files with 13 additions and 11 deletions

View File

@ -531,11 +531,12 @@ GetAllDependencyCreateDDLCommands(const List *dependencies)
* previously marked objects to a worker node. The function also sets * previously marked objects to a worker node. The function also sets
* clusterHasDistributedFunction if there are any distributed functions. * clusterHasDistributedFunction if there are any distributed functions.
*/ */
List * void
ReplicateAllObjectsToNodeCommandList(const char *nodeName, int nodePort) ReplicateAllObjectsToNodeCommandList(const char *nodeName, int nodePort,
List **ddlCommands)
{ {
/* since we are executing ddl commands disable propagation first, primarily for mx */ /* since we are executing ddl commands disable propagation first, primarily for mx */
List *ddlCommands = list_make1(DISABLE_DDL_PROPAGATION); *ddlCommands = list_make1(DISABLE_DDL_PROPAGATION);
/* /*
* collect all dependencies in creation order and get their ddl commands * collect all dependencies in creation order and get their ddl commands
@ -578,13 +579,11 @@ ReplicateAllObjectsToNodeCommandList(const char *nodeName, int nodePort)
continue; continue;
} }
ddlCommands = list_concat(ddlCommands, *ddlCommands = list_concat(*ddlCommands,
GetDependencyCreateDDLCommands(dependency)); GetDependencyCreateDDLCommands(dependency));
} }
ddlCommands = lappend(ddlCommands, ENABLE_DDL_PROPAGATION); *ddlCommands = lappend(*ddlCommands, ENABLE_DDL_PROPAGATION);
return ddlCommands;
} }

View File

@ -827,8 +827,10 @@ SyncDistributedObjectsCommandList(WorkerNode *workerNode, List **commandList)
/* /*
* Replicate all objects of the pg_dist_object to the remote node. * Replicate all objects of the pg_dist_object to the remote node.
*/ */
*commandList = list_concat(*commandList, ReplicateAllObjectsToNodeCommandList( List *replicateAllObjectsToNodeCommandList = NIL;
workerNode->workerName, workerNode->workerPort)); ReplicateAllObjectsToNodeCommandList(workerNode->workerName, workerNode->workerPort,
&replicateAllObjectsToNodeCommandList);
*commandList = list_concat(*commandList, replicateAllObjectsToNodeCommandList);
/* /*
* After creating each table, handle the inter table relationship between * After creating each table, handle the inter table relationship between

View File

@ -343,7 +343,8 @@ extern List * GetAllDependencyCreateDDLCommands(const List *dependencies);
extern bool ShouldPropagate(void); extern bool ShouldPropagate(void);
extern bool ShouldPropagateCreateInCoordinatedTransction(void); extern bool ShouldPropagateCreateInCoordinatedTransction(void);
extern bool ShouldPropagateAnyObject(List *addresses); extern bool ShouldPropagateAnyObject(List *addresses);
extern List * ReplicateAllObjectsToNodeCommandList(const char *nodeName, int nodePort); extern void ReplicateAllObjectsToNodeCommandList(const char *nodeName, int nodePort,
List **ddlCommands);
/* Remaining metadata utility functions */ /* Remaining metadata utility functions */
extern Oid TableOwnerOid(Oid relationId); extern Oid TableOwnerOid(Oid relationId);