mirror of https://github.com/citusdata/citus.git
Merge pull request #974 from citusdata/fix/use_access_share_lock
Use AccessShareLock on the source table while creating a colocated tablepull/979/head
commit
ce3019d39e
|
@ -41,6 +41,7 @@
|
||||||
#include "nodes/primnodes.h"
|
#include "nodes/primnodes.h"
|
||||||
#include "postmaster/postmaster.h"
|
#include "postmaster/postmaster.h"
|
||||||
#include "storage/fd.h"
|
#include "storage/fd.h"
|
||||||
|
#include "storage/lmgr.h"
|
||||||
#include "storage/lock.h"
|
#include "storage/lock.h"
|
||||||
#include "utils/builtins.h"
|
#include "utils/builtins.h"
|
||||||
#include "utils/elog.h"
|
#include "utils/elog.h"
|
||||||
|
@ -247,8 +248,8 @@ CreateColocatedShards(Oid targetRelationId, Oid sourceRelationId)
|
||||||
/* we plan to add shards: get an exclusive metadata lock on the target relation */
|
/* we plan to add shards: get an exclusive metadata lock on the target relation */
|
||||||
LockRelationDistributionMetadata(targetRelationId, ExclusiveLock);
|
LockRelationDistributionMetadata(targetRelationId, ExclusiveLock);
|
||||||
|
|
||||||
/* a share metadata lock is enough on the source relation */
|
/* we don't want source table to get dropped before we colocate with it */
|
||||||
LockRelationDistributionMetadata(sourceRelationId, ShareLock);
|
LockRelationOid(sourceRelationId, AccessShareLock);
|
||||||
|
|
||||||
/* prevent placement changes of the source relation until we colocate with them */
|
/* prevent placement changes of the source relation until we colocate with them */
|
||||||
sourceShardIntervalList = LoadShardIntervalList(sourceRelationId);
|
sourceShardIntervalList = LoadShardIntervalList(sourceRelationId);
|
||||||
|
|
Loading…
Reference in New Issue