But shardId field of the Task structure is only defined for shard fetch tasks. Therefore, for this context, it becomes 0.
typedef struct Task
{
...
uint64 shardId; /* only applies to shard fetch tasks */
...
}
For testing purposes, you can run copy_to_distributed_table and shard rebalancer in parallel and see that that they do not block each other.
Again for testing purposes, I set shardid to task->anchorShardId (not sure if this is a proper way to fix this issue, but it was okay for my testing purposes) and saw that copy_to_distributed_table and shard rebalancer blocked each other as expected.
RouterExecutorRun() calls AcquireExecutorShardLock().
But shardId field of the Task structure is only defined for shard fetch tasks. Therefore, for this context, it becomes 0.
For testing purposes, you can run copy_to_distributed_table and shard rebalancer in parallel and see that that they do not block each other.
Again for testing purposes, I set shardid to task->anchorShardId (not sure if this is a proper way to fix this issue, but it was okay for my testing purposes) and saw that copy_to_distributed_table and shard rebalancer blocked each other as expected.