mirror of https://github.com/citusdata/citus.git
DROP TABLE becomes idempotent for metadata sync - t2
parent
805e58e187
commit
a41953d5bb
|
@ -610,7 +610,7 @@ SyncNodeMetadataSnapshotToNode(WorkerNode *workerNode, bool raiseOnError)
|
|||
char *currentUser = CurrentUserName();
|
||||
|
||||
/* generate and add the local group id's update query */
|
||||
char *localGroupIdUpdateCommand = LocalGroupIdUpdateCommand(workerNode->groupId);
|
||||
//char *localGroupIdUpdateCommand = LocalGroupIdUpdateCommand(workerNode->groupId);
|
||||
|
||||
/* generate the queries which drop the node metadata */
|
||||
List *dropMetadataCommandList = NodeMetadataDropCommands();
|
||||
|
@ -618,7 +618,7 @@ SyncNodeMetadataSnapshotToNode(WorkerNode *workerNode, bool raiseOnError)
|
|||
/* generate the queries which create the node metadata from scratch */
|
||||
List *createMetadataCommandList = NodeMetadataCreateCommands();
|
||||
|
||||
List *recreateMetadataSnapshotCommandList = list_make1(localGroupIdUpdateCommand);
|
||||
List *recreateMetadataSnapshotCommandList = NIL;//list_make1(localGroupIdUpdateCommand);
|
||||
recreateMetadataSnapshotCommandList = list_concat(recreateMetadataSnapshotCommandList,
|
||||
dropMetadataCommandList);
|
||||
recreateMetadataSnapshotCommandList = list_concat(recreateMetadataSnapshotCommandList,
|
||||
|
|
|
@ -857,6 +857,12 @@ SyncDistributedObjectsToNodeList(List *workerNodeList)
|
|||
|
||||
Assert(ShouldPropagate());
|
||||
|
||||
/* send commands to new workers, the current user should be a superuser */
|
||||
Assert(superuser());
|
||||
SendBareCommandListToWorkers(
|
||||
list_make1(workerNode),
|
||||
list_make1(LocalGroupIdUpdateCommand(workerNode->groupId)));
|
||||
|
||||
List *commandList = SyncDistributedObjectsCommandList(workerNode);
|
||||
|
||||
/* send commands to new workers, the current user should be a superuser */
|
||||
|
@ -878,8 +884,9 @@ UpdateLocalGroupIdOnNode(WorkerNode *workerNode)
|
|||
|
||||
/* send commands to new workers, the current user should be a superuser */
|
||||
Assert(superuser());
|
||||
SendBareCommandListToWorkers(
|
||||
SendMetadataCommandListToWorkerListInCoordinatedTransaction(
|
||||
list_make1(workerNode),
|
||||
CurrentUserName(),
|
||||
commandList);
|
||||
}
|
||||
}
|
||||
|
@ -1187,12 +1194,6 @@ ActivateNodeList(List *nodeList)
|
|||
bool syncMetadata = EnableMetadataSync && NodeIsPrimary(workerNode);
|
||||
if (syncMetadata)
|
||||
{
|
||||
/*
|
||||
* Update local group id first, as object dependency logic requires to have
|
||||
* updated local group id.
|
||||
*/
|
||||
UpdateLocalGroupIdOnNode(workerNode);
|
||||
|
||||
/*
|
||||
* We are going to sync the metadata anyway in this transaction, so do
|
||||
* not fail just because the current metadata is not synced.
|
||||
|
|
|
@ -614,7 +614,7 @@ ErrorIfAnyMetadataNodeOutOfSync(List *metadataNodeList)
|
|||
bool
|
||||
IsWorkerTheCurrentNode(WorkerNode *workerNode)
|
||||
{
|
||||
int connectionFlags = REQUIRE_METADATA_CONNECTION;
|
||||
int connectionFlags = FORCE_NEW_CONNECTION;
|
||||
|
||||
MultiConnection *workerConnection =
|
||||
GetNodeUserDatabaseConnection(connectionFlags,
|
||||
|
@ -663,6 +663,7 @@ IsWorkerTheCurrentNode(WorkerNode *workerNode)
|
|||
}
|
||||
|
||||
char *currentServerId = text_to_cstring(currentServerIdTextP);
|
||||
CloseConnection(workerConnection);
|
||||
|
||||
return strcmp(workerServerId, currentServerId) == 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue