mirror of https://github.com/citusdata/citus.git
Change the order in which the locks are acquired.
parent
aeded49fc8
commit
1b8ed32189
|
@ -707,13 +707,10 @@ SerializeNonCommutativeWrites(List *shardIntervalList, LOCKMODE lockMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
List *replicatedShardList = NIL;
|
List *replicatedShardList = NIL;
|
||||||
if (AnyTableReplicated(shardIntervalList, &replicatedShardList))
|
bool anyTableReplicated = AnyTableReplicated(shardIntervalList, &replicatedShardList);
|
||||||
{
|
|
||||||
if (ClusterHasKnownMetadataWorkers() && !IsFirstWorkerNode())
|
|
||||||
{
|
|
||||||
LockShardListResourcesOnFirstWorker(lockMode, replicatedShardList);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (anyTableReplicated)
|
||||||
|
{
|
||||||
ShardInterval *firstShardInterval =
|
ShardInterval *firstShardInterval =
|
||||||
(ShardInterval *) linitial(replicatedShardList);
|
(ShardInterval *) linitial(replicatedShardList);
|
||||||
if (ReferenceTableShardId(firstShardInterval->shardId))
|
if (ReferenceTableShardId(firstShardInterval->shardId))
|
||||||
|
@ -728,7 +725,10 @@ SerializeNonCommutativeWrites(List *shardIntervalList, LOCKMODE lockMode)
|
||||||
LockReferencedReferenceShardResources(firstShardInterval->shardId, lockMode);
|
LockReferencedReferenceShardResources(firstShardInterval->shardId, lockMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (anyTableReplicated && ClusterHasKnownMetadataWorkers() && !IsFirstWorkerNode())
|
||||||
|
{
|
||||||
|
LockShardListResourcesOnFirstWorker(lockMode, replicatedShardList);
|
||||||
|
}
|
||||||
LockShardListResources(shardIntervalList, lockMode);
|
LockShardListResources(shardIntervalList, lockMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,16 +45,16 @@ SELECT * FROM master_run_on_worker(
|
||||||
true);
|
true);
|
||||||
node_name | node_port | success | result
|
node_name | node_port | success | result
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
localhost | 57638 | f | ERROR: deadlock detected
|
localhost | 57638 | t | UPDATE 1
|
||||||
|
localhost | 57637 | t | UPDATE 1
|
||||||
|
localhost | 57637 | t | UPDATE 1
|
||||||
|
localhost | 57638 | t | UPDATE 1
|
||||||
|
localhost | 57637 | t | UPDATE 1
|
||||||
|
localhost | 57638 | t | UPDATE 1
|
||||||
|
localhost | 57637 | t | UPDATE 1
|
||||||
|
localhost | 57638 | t | UPDATE 1
|
||||||
|
localhost | 57638 | t | UPDATE 1
|
||||||
localhost | 57637 | t | UPDATE 1
|
localhost | 57637 | t | UPDATE 1
|
||||||
localhost | 57637 | f | ERROR: deadlock detected
|
|
||||||
localhost | 57638 | f | ERROR: deadlock detected
|
|
||||||
localhost | 57637 | f | ERROR: canceling the transaction since it was involved in a distributed deadlock
|
|
||||||
localhost | 57638 | f | ERROR: deadlock detected
|
|
||||||
localhost | 57637 | f | ERROR: deadlock detected
|
|
||||||
localhost | 57638 | f | ERROR: deadlock detected
|
|
||||||
localhost | 57638 | f | ERROR: canceling the transaction since it was involved in a distributed deadlock
|
|
||||||
localhost | 57637 | f | ERROR: deadlock detected
|
|
||||||
(10 rows)
|
(10 rows)
|
||||||
|
|
||||||
--- cleanup
|
--- cleanup
|
||||||
|
|
Loading…
Reference in New Issue