Add the locking mechanism before the check for whether the coordinator already exists

pull/7682/head
Mehmet YILMAZ 2024-09-04 14:50:03 +00:00
parent 68d28ecdc0
commit 3e5afb2d6e
2 changed files with 4 additions and 0 deletions

1
citus-tools Submodule

@ -0,0 +1 @@
Subproject commit 3376bd6845f0614908ed304f5033bd644c82d3bf

View File

@ -217,6 +217,9 @@ citus_set_coordinator_host(PG_FUNCTION_ARGS)
EnsureTransactionalMetadataSyncMode(); EnsureTransactionalMetadataSyncMode();
} }
/* prevent concurrent modification */
LockRelationOid(DistNodeRelationId(), RowExclusiveLock);
bool isCoordinatorInMetadata = false; bool isCoordinatorInMetadata = false;
WorkerNode *coordinatorNode = PrimaryNodeForGroup(COORDINATOR_GROUP_ID, WorkerNode *coordinatorNode = PrimaryNodeForGroup(COORDINATOR_GROUP_ID,
&isCoordinatorInMetadata); &isCoordinatorInMetadata);