mirror of https://github.com/citusdata/citus.git
All users of WorkerNodeHash take an AccessShareLock
The metadata cache simulates a SELECT on pg_dist_node. Now the locks it takes also simulate that SELECT.pull/1519/head
parent
5914c992e6
commit
a3e9bef685
|
@ -174,8 +174,6 @@ DistributedTableSize(Oid relationId, char *sizeQuery)
|
|||
|
||||
ErrorIfNotSuitableToGetSize(relationId);
|
||||
|
||||
LockRelationOid(DistNodeRelationId(), AccessShareLock);
|
||||
|
||||
workerNodeList = ActivePrimaryNodeList();
|
||||
|
||||
foreach(workerNodeCell, workerNodeList)
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nodes/makefuncs.h"
|
||||
#include "parser/parse_func.h"
|
||||
#include "parser/parse_type.h"
|
||||
#include "storage/lmgr.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/catcache.h"
|
||||
#include "utils/datum.h"
|
||||
|
@ -2272,6 +2273,12 @@ GetWorkerNodeHash(void)
|
|||
{
|
||||
InitializeCaches(); /* ensure relevant callbacks are registered */
|
||||
|
||||
/*
|
||||
* Simulate a SELECT from pg_dist_node, ensure pg_dist_node doesn't change while our
|
||||
* caller is using WorkerNodeHash.
|
||||
*/
|
||||
LockRelationOid(DistNodeRelationId(), AccessShareLock);
|
||||
|
||||
/*
|
||||
* We might have some concurrent metadata changes. In order to get the changes,
|
||||
* we first need to accept the cache invalidation messages.
|
||||
|
|
|
@ -230,7 +230,6 @@ ReplicateShardToAllWorkers(ShardInterval *shardInterval)
|
|||
List *workerNodeList = NULL;
|
||||
ListCell *workerNodeCell = NULL;
|
||||
|
||||
LockRelationOid(DistNodeRelationId(), AccessShareLock);
|
||||
workerNodeList = ActivePrimaryNodeList();
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue