mirror of https://github.com/citusdata/citus.git
Acquire shard resource locks on parent tables while operating on partitions
parent
a321e750c0
commit
dfdfb44ebf
|
@ -298,6 +298,11 @@ AcquireExecutorMultiShardLocks(List *taskList)
|
||||||
lockMode = ExclusiveLock;
|
lockMode = ExclusiveLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are dealing with a partition we are also taking locks on parent table
|
||||||
|
* to prevent deadlocks on concurrent operations on a partition and its parent.
|
||||||
|
*/
|
||||||
|
LockParentShardResourceIfPartition(task->anchorShardId, lockMode);
|
||||||
LockShardResource(task->anchorShardId, lockMode);
|
LockShardResource(task->anchorShardId, lockMode);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -321,9 +321,9 @@ LockRelationShardResources(List *relationShardList, LOCKMODE lockMode)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LockParentShardResourceIfPartition checks whether given shard belongs to a
|
* LockParentShardResourceIfPartition checks whether the given shard belongs
|
||||||
* partition. If it is, LockParentShardResourceIfPartition acquires a shard
|
* to a partition. If it does, LockParentShardResourceIfPartition acquires a
|
||||||
* resource lock on the colocated shard of the parent table.
|
* shard resource lock on the colocated shard of the parent table.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
LockParentShardResourceIfPartition(uint64 shardId, LOCKMODE lockMode)
|
LockParentShardResourceIfPartition(uint64 shardId, LOCKMODE lockMode)
|
||||||
|
|
|
@ -84,4 +84,7 @@ extern void LockRelationShardResources(List *relationShardList, LOCKMODE lockMod
|
||||||
extern void LockPartitionsInRelationList(List *relationIdList, LOCKMODE lockmode);
|
extern void LockPartitionsInRelationList(List *relationIdList, LOCKMODE lockmode);
|
||||||
extern void LockPartitionRelations(Oid relationId, LOCKMODE lockMode);
|
extern void LockPartitionRelations(Oid relationId, LOCKMODE lockMode);
|
||||||
|
|
||||||
|
/* Lock parent table's colocated shard resource */
|
||||||
|
extern void LockParentShardResourceIfPartition(uint64 shardId, LOCKMODE lockMode);
|
||||||
|
|
||||||
#endif /* RESOURCE_LOCK_H */
|
#endif /* RESOURCE_LOCK_H */
|
||||||
|
|
Loading…
Reference in New Issue