From 07bf9b5a74f9028b4f0abd5adae633e9de6dee6b Mon Sep 17 00:00:00 2001 From: gentle_hu Date: Tue, 2 Aug 2022 10:59:01 +0800 Subject: [PATCH] fix the bug of grpc lock initialization --- src/gausskernel/storage/lmgr/lwlock.cpp | 6 ++++++ src/include/storage/lock/lwlock.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gausskernel/storage/lmgr/lwlock.cpp b/src/gausskernel/storage/lmgr/lwlock.cpp index 93f40401c..38d9888df 100644 --- a/src/gausskernel/storage/lmgr/lwlock.cpp +++ b/src/gausskernel/storage/lmgr/lwlock.cpp @@ -188,6 +188,7 @@ static const char *BuiltinTrancheNames[] = { "SegmentHeadPartitionLock", "TwoPhaseStatePartLock", "RoleIdPartLock", + "GPRCMappingLock", "PgwrSyncQueueLock", "BarrierHashTblLock", "PageRepairHashTblLock", @@ -627,6 +628,11 @@ static void InitializeLWLocks(int numLocks) for (id = 0; id < NUM_SESSION_ROLEID_PARTITIONS; id++, lock++) { LWLockInitialize(&lock->lock, LWTRANCHE_ROLEID_PARTITION); } + + for (id = 0; id < NUM_GPRC_PARTITIONS; id++, lock++) { + LWLockInitialize(&lock->lock, LWTRANCHE_GPRC_MAPPING); + } + Assert((lock - t_thrd.shemem_ptr_cxt.mainLWLockArray) == NumFixedLWLocks); for (id = NumFixedLWLocks; id < numLocks; id++, lock++) { diff --git a/src/include/storage/lock/lwlock.h b/src/include/storage/lock/lwlock.h index cd07da784..d007b6eb0 100644 --- a/src/include/storage/lock/lwlock.h +++ b/src/include/storage/lock/lwlock.h @@ -183,9 +183,10 @@ const struct LWLOCK_PARTITION_DESC LWLockPartInfo[] = { #define FirstTwoPhaseStateLock (FirstSegmentHeadLock + NUM_SEGMENT_HEAD_PARTITIONS) /* session roleid */ #define FirstSessRoleIdLock (FirstTwoPhaseStateLock + NUM_TWOPHASE_PARTITIONS) +/* autonomous transaction package value */ #define FirstGPRCMappingLock (FirstSessRoleIdLock + NUM_SESSION_ROLEID_PARTITIONS) /* must be last: */ -#define NumFixedLWLocks (FirstSessRoleIdLock + NUM_SESSION_ROLEID_PARTITIONS) +#define NumFixedLWLocks (FirstGPRCMappingLock + NUM_GPRC_PARTITIONS) /* * WARNING----Please keep BuiltinTrancheIds and BuiltinTrancheNames consistent!!! * @@ -254,6 +255,7 @@ enum BuiltinTrancheIds LWTRANCHE_SEGHEAD_PARTITION, LWTRANCHE_TWOPHASE_STATE, LWTRANCHE_ROLEID_PARTITION, + LWTRANCHE_GPRC_MAPPING, LWTRANCHE_PGWR_SYNC_QUEUE, LWTRANCHE_BARRIER_TBL, LWTRANCHE_PAGE_REPAIR,