mirror of https://github.com/citusdata/citus.git
Do not acquire locks on node metadata explicitly
parent
b70949ae8c
commit
f4e8af2c22
|
@ -148,16 +148,6 @@ PostprocessCreateExtensionStmt(Node *node, const char *queryString)
|
||||||
/* extension management can only be done via coordinator node */
|
/* extension management can only be done via coordinator node */
|
||||||
EnsureCoordinator();
|
EnsureCoordinator();
|
||||||
|
|
||||||
/*
|
|
||||||
* Make sure that no new nodes are added after this point until the end of the
|
|
||||||
* transaction by taking a RowShareLock on pg_dist_node, which conflicts with the
|
|
||||||
* ExclusiveLock taken by citus_add_node.
|
|
||||||
* This guarantees that all active nodes will have the extension, because they will
|
|
||||||
* either get it now, or get it in citus_add_node after this transaction finishes and
|
|
||||||
* the pg_dist_object record becomes visible.
|
|
||||||
*/
|
|
||||||
LockRelationOid(DistNodeRelationId(), RowShareLock);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure that the current transaction is already in sequential mode,
|
* Make sure that the current transaction is already in sequential mode,
|
||||||
* or can still safely be put in sequential mode
|
* or can still safely be put in sequential mode
|
||||||
|
@ -259,16 +249,6 @@ PreprocessDropExtensionStmt(Node *node, const char *queryString,
|
||||||
/* extension management can only be done via coordinator node */
|
/* extension management can only be done via coordinator node */
|
||||||
EnsureCoordinator();
|
EnsureCoordinator();
|
||||||
|
|
||||||
/*
|
|
||||||
* Make sure that no new nodes are added after this point until the end of the
|
|
||||||
* transaction by taking a RowShareLock on pg_dist_node, which conflicts with the
|
|
||||||
* ExclusiveLock taken by citus_add_node.
|
|
||||||
* This guarantees that all active nodes will drop the extension, because they will
|
|
||||||
* either get it now, or get it in citus_add_node after this transaction finishes and
|
|
||||||
* the pg_dist_object record becomes visible.
|
|
||||||
*/
|
|
||||||
LockRelationOid(DistNodeRelationId(), RowShareLock);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure that the current transaction is already in sequential mode,
|
* Make sure that the current transaction is already in sequential mode,
|
||||||
* or can still safely be put in sequential mode
|
* or can still safely be put in sequential mode
|
||||||
|
@ -395,15 +375,6 @@ PreprocessAlterExtensionSchemaStmt(Node *node, const char *queryString,
|
||||||
/* extension management can only be done via coordinator node */
|
/* extension management can only be done via coordinator node */
|
||||||
EnsureCoordinator();
|
EnsureCoordinator();
|
||||||
|
|
||||||
/*
|
|
||||||
* Make sure that no new nodes are added after this point until the end of the
|
|
||||||
* transaction by taking a RowShareLock on pg_dist_node, which conflicts with the
|
|
||||||
* ExclusiveLock taken by citus_add_node.
|
|
||||||
* This guarantees that all active nodes will update the extension schema after
|
|
||||||
* this transaction finishes and the pg_dist_object record becomes visible.
|
|
||||||
*/
|
|
||||||
LockRelationOid(DistNodeRelationId(), RowShareLock);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure that the current transaction is already in sequential mode,
|
* Make sure that the current transaction is already in sequential mode,
|
||||||
* or can still safely be put in sequential mode
|
* or can still safely be put in sequential mode
|
||||||
|
@ -463,16 +434,6 @@ PreprocessAlterExtensionUpdateStmt(Node *node, const char *queryString,
|
||||||
/* extension management can only be done via coordinator node */
|
/* extension management can only be done via coordinator node */
|
||||||
EnsureCoordinator();
|
EnsureCoordinator();
|
||||||
|
|
||||||
/*
|
|
||||||
* Make sure that no new nodes are added after this point until the end of the
|
|
||||||
* transaction by taking a RowShareLock on pg_dist_node, which conflicts with the
|
|
||||||
* ExclusiveLock taken by citus_add_node.
|
|
||||||
* This guarantees that all active nodes will update the extension version, because
|
|
||||||
* they will either get it now, or get it in citus_add_node after this transaction
|
|
||||||
* finishes and the pg_dist_object record becomes visible.
|
|
||||||
*/
|
|
||||||
LockRelationOid(DistNodeRelationId(), RowShareLock);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure that the current transaction is already in sequential mode,
|
* Make sure that the current transaction is already in sequential mode,
|
||||||
* or can still safely be put in sequential mode
|
* or can still safely be put in sequential mode
|
||||||
|
|
|
@ -140,13 +140,6 @@ PostprocessAlterRoleStmt(Node *node, const char *queryString)
|
||||||
|
|
||||||
AlterRoleStmt *stmt = castNode(AlterRoleStmt, node);
|
AlterRoleStmt *stmt = castNode(AlterRoleStmt, node);
|
||||||
|
|
||||||
/*
|
|
||||||
* Make sure that no new nodes are added after this point until the end of the
|
|
||||||
* transaction by taking a RowShareLock on pg_dist_node, which conflicts with the
|
|
||||||
* ExclusiveLock taken by citus_add_node.
|
|
||||||
*/
|
|
||||||
LockRelationOid(DistNodeRelationId(), RowShareLock);
|
|
||||||
|
|
||||||
DefElem *option = NULL;
|
DefElem *option = NULL;
|
||||||
foreach_ptr(option, stmt->options)
|
foreach_ptr(option, stmt->options)
|
||||||
{
|
{
|
||||||
|
|
|
@ -129,16 +129,6 @@ PreprocessCompositeTypeStmt(Node *node, const char *queryString,
|
||||||
*/
|
*/
|
||||||
EnsureCoordinator();
|
EnsureCoordinator();
|
||||||
|
|
||||||
/*
|
|
||||||
* Make sure that no new nodes are added after this point until the end of the
|
|
||||||
* transaction by taking a RowShareLock on pg_dist_node, which conflicts with the
|
|
||||||
* ExclusiveLock taken by citus_add_node.
|
|
||||||
* This guarantees that all active nodes will have the object, because they will
|
|
||||||
* either get it now, or get it in citus_add_node after this transaction finishes and
|
|
||||||
* the pg_dist_object record becomes visible.
|
|
||||||
*/
|
|
||||||
LockRelationOid(DistNodeRelationId(), RowShareLock);
|
|
||||||
|
|
||||||
/* fully qualify before lookup and later deparsing */
|
/* fully qualify before lookup and later deparsing */
|
||||||
QualifyTreeNode(node);
|
QualifyTreeNode(node);
|
||||||
|
|
||||||
|
|
|
@ -188,9 +188,6 @@ citus_set_coordinator_host(PG_FUNCTION_ARGS)
|
||||||
Name nodeClusterName = PG_GETARG_NAME(3);
|
Name nodeClusterName = PG_GETARG_NAME(3);
|
||||||
nodeMetadata.nodeCluster = NameStr(*nodeClusterName);
|
nodeMetadata.nodeCluster = NameStr(*nodeClusterName);
|
||||||
|
|
||||||
/* prevent concurrent modification */
|
|
||||||
LockRelationOid(DistNodeRelationId(), RowShareLock);
|
|
||||||
|
|
||||||
bool isCoordinatorInMetadata = false;
|
bool isCoordinatorInMetadata = false;
|
||||||
WorkerNode *coordinatorNode = PrimaryNodeForGroup(COORDINATOR_GROUP_ID,
|
WorkerNode *coordinatorNode = PrimaryNodeForGroup(COORDINATOR_GROUP_ID,
|
||||||
&isCoordinatorInMetadata);
|
&isCoordinatorInMetadata);
|
||||||
|
@ -1780,12 +1777,6 @@ AddNodeMetadata(char *nodeName, int32 nodePort,
|
||||||
|
|
||||||
*nodeAlreadyExists = false;
|
*nodeAlreadyExists = false;
|
||||||
|
|
||||||
/*
|
|
||||||
* Prevent / wait for concurrent modification before checking whether
|
|
||||||
* the worker already exists in pg_dist_node.
|
|
||||||
*/
|
|
||||||
LockRelationOid(DistNodeRelationId(), RowShareLock);
|
|
||||||
|
|
||||||
WorkerNode *workerNode = FindWorkerNodeAnyCluster(nodeName, nodePort);
|
WorkerNode *workerNode = FindWorkerNodeAnyCluster(nodeName, nodePort);
|
||||||
if (workerNode != NULL)
|
if (workerNode != NULL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue