mirror of https://github.com/citusdata/citus.git
Avoid attempting to lock invalid shard identifier
A recent change generates a "dummy" shard placement with its identifier set to INVALID_SHARD_ID for SELECT queries against distributed tables with no shards. Normally, no lock is acquired for SELECT statements, but if all_modifications_commutative is set to true, we will acquire a shared lock, triggering an assertion failure within LockShardResource in the above case. The "dummy" shard placement is actually necessary to ensure such empty queries have somewhere to execute, and INVALID_SHARD_ID seems the most appropriate value for the dummy's shard identifier field, so the most straightforward fix is to just avoid locking invalid shard identifiers.pull/706/head
parent
ccc32f9da8
commit
eba8396501
|
@ -294,7 +294,10 @@ AcquireExecutorShardLock(Task *task, LOCKMODE lockMode)
|
||||||
{
|
{
|
||||||
int64 shardId = task->anchorShardId;
|
int64 shardId = task->anchorShardId;
|
||||||
|
|
||||||
|
if (shardId != INVALID_SHARD_ID)
|
||||||
|
{
|
||||||
LockShardResource(shardId, lockMode);
|
LockShardResource(shardId, lockMode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue