mirror of https://github.com/citusdata/citus.git
Refactor: ReplicateShardToAllWorkers more explicitly locks pg_dist_node
parent
f87fefa323
commit
94947c0d54
|
@ -28,6 +28,7 @@
|
|||
#include "distributed/transaction_management.h"
|
||||
#include "distributed/worker_manager.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "utils/fmgroids.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/rel.h"
|
||||
|
@ -226,11 +227,12 @@ ReplicateSingleShardTableToAllWorkers(Oid relationId)
|
|||
static void
|
||||
ReplicateShardToAllWorkers(ShardInterval *shardInterval)
|
||||
{
|
||||
/* we do not use pgDistNode, we only obtain a lock on it to prevent modifications */
|
||||
Relation pgDistNode = heap_open(DistNodeRelationId(), AccessShareLock);
|
||||
List *workerNodeList = ActivePrimaryNodeList();
|
||||
List *workerNodeList = NULL;
|
||||
ListCell *workerNodeCell = NULL;
|
||||
|
||||
LockRelationOid(DistNodeRelationId(), AccessShareLock);
|
||||
workerNodeList = ActivePrimaryNodeList();
|
||||
|
||||
/*
|
||||
* We will iterate over all worker nodes and if healthy placement is not exist at
|
||||
* given node we will copy the shard to that node. Then we will also modify
|
||||
|
@ -245,8 +247,6 @@ ReplicateShardToAllWorkers(ShardInterval *shardInterval)
|
|||
|
||||
ReplicateShardToNode(shardInterval, nodeName, nodePort);
|
||||
}
|
||||
|
||||
heap_close(pgDistNode, NoLock);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue