mirror of https://github.com/citusdata/citus.git
Merge pull request #344 from citusdata/fix_shard_lock_acquisition#342
Ensure router executor acquires proper shard lock cr: @onderkalacipull/1938/head
commit
27edf02484
|
@ -154,7 +154,7 @@ CommutativityRuleToLockMode(CmdType commandType, bool upsertQuery)
|
||||||
static void
|
static void
|
||||||
AcquireExecutorShardLock(Task *task, LOCKMODE lockMode)
|
AcquireExecutorShardLock(Task *task, LOCKMODE lockMode)
|
||||||
{
|
{
|
||||||
int64 shardId = task->shardId;
|
int64 shardId = task->anchorShardId;
|
||||||
|
|
||||||
LockShardResource(shardId, lockMode);
|
LockShardResource(shardId, lockMode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
#include "c.h"
|
||||||
#include "miscadmin.h"
|
#include "miscadmin.h"
|
||||||
|
|
||||||
|
#include "distributed/relay_utility.h"
|
||||||
#include "distributed/resource_lock.h"
|
#include "distributed/resource_lock.h"
|
||||||
#include "storage/lmgr.h"
|
#include "storage/lmgr.h"
|
||||||
|
|
||||||
|
@ -68,6 +69,8 @@ LockShardResource(uint64 shardId, LOCKMODE lockmode)
|
||||||
const bool sessionLock = false;
|
const bool sessionLock = false;
|
||||||
const bool dontWait = false;
|
const bool dontWait = false;
|
||||||
|
|
||||||
|
AssertArg(shardId != INVALID_SHARD_ID);
|
||||||
|
|
||||||
SET_LOCKTAG_SHARD_RESOURCE(tag, MyDatabaseId, shardId);
|
SET_LOCKTAG_SHARD_RESOURCE(tag, MyDatabaseId, shardId);
|
||||||
|
|
||||||
(void) LockAcquire(&tag, lockmode, sessionLock, dontWait);
|
(void) LockAcquire(&tag, lockmode, sessionLock, dontWait);
|
||||||
|
|
Loading…
Reference in New Issue