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();
|
char *currentUser = CurrentUserName();
|
||||||
|
|
||||||
/* generate and add the local group id's update query */
|
/* 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 */
|
/* generate the queries which drop the node metadata */
|
||||||
List *dropMetadataCommandList = NodeMetadataDropCommands();
|
List *dropMetadataCommandList = NodeMetadataDropCommands();
|
||||||
|
@ -618,7 +618,7 @@ SyncNodeMetadataSnapshotToNode(WorkerNode *workerNode, bool raiseOnError)
|
||||||
/* generate the queries which create the node metadata from scratch */
|
/* generate the queries which create the node metadata from scratch */
|
||||||
List *createMetadataCommandList = NodeMetadataCreateCommands();
|
List *createMetadataCommandList = NodeMetadataCreateCommands();
|
||||||
|
|
||||||
List *recreateMetadataSnapshotCommandList = list_make1(localGroupIdUpdateCommand);
|
List *recreateMetadataSnapshotCommandList = NIL;//list_make1(localGroupIdUpdateCommand);
|
||||||
recreateMetadataSnapshotCommandList = list_concat(recreateMetadataSnapshotCommandList,
|
recreateMetadataSnapshotCommandList = list_concat(recreateMetadataSnapshotCommandList,
|
||||||
dropMetadataCommandList);
|
dropMetadataCommandList);
|
||||||
recreateMetadataSnapshotCommandList = list_concat(recreateMetadataSnapshotCommandList,
|
recreateMetadataSnapshotCommandList = list_concat(recreateMetadataSnapshotCommandList,
|
||||||
|
|
|
@ -857,6 +857,12 @@ SyncDistributedObjectsToNodeList(List *workerNodeList)
|
||||||
|
|
||||||
Assert(ShouldPropagate());
|
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);
|
List *commandList = SyncDistributedObjectsCommandList(workerNode);
|
||||||
|
|
||||||
/* send commands to new workers, the current user should be a superuser */
|
/* 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 */
|
/* send commands to new workers, the current user should be a superuser */
|
||||||
Assert(superuser());
|
Assert(superuser());
|
||||||
SendBareCommandListToWorkers(
|
SendMetadataCommandListToWorkerListInCoordinatedTransaction(
|
||||||
list_make1(workerNode),
|
list_make1(workerNode),
|
||||||
|
CurrentUserName(),
|
||||||
commandList);
|
commandList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1187,12 +1194,6 @@ ActivateNodeList(List *nodeList)
|
||||||
bool syncMetadata = EnableMetadataSync && NodeIsPrimary(workerNode);
|
bool syncMetadata = EnableMetadataSync && NodeIsPrimary(workerNode);
|
||||||
if (syncMetadata)
|
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
|
* We are going to sync the metadata anyway in this transaction, so do
|
||||||
* not fail just because the current metadata is not synced.
|
* not fail just because the current metadata is not synced.
|
||||||
|
|
|
@ -614,7 +614,7 @@ ErrorIfAnyMetadataNodeOutOfSync(List *metadataNodeList)
|
||||||
bool
|
bool
|
||||||
IsWorkerTheCurrentNode(WorkerNode *workerNode)
|
IsWorkerTheCurrentNode(WorkerNode *workerNode)
|
||||||
{
|
{
|
||||||
int connectionFlags = REQUIRE_METADATA_CONNECTION;
|
int connectionFlags = FORCE_NEW_CONNECTION;
|
||||||
|
|
||||||
MultiConnection *workerConnection =
|
MultiConnection *workerConnection =
|
||||||
GetNodeUserDatabaseConnection(connectionFlags,
|
GetNodeUserDatabaseConnection(connectionFlags,
|
||||||
|
@ -663,6 +663,7 @@ IsWorkerTheCurrentNode(WorkerNode *workerNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *currentServerId = text_to_cstring(currentServerIdTextP);
|
char *currentServerId = text_to_cstring(currentServerIdTextP);
|
||||||
|
CloseConnection(workerConnection);
|
||||||
|
|
||||||
return strcmp(workerServerId, currentServerId) == 0;
|
return strcmp(workerServerId, currentServerId) == 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue