From b6fb01e80e5d86d4a15436fcf69df6e6e17c677f Mon Sep 17 00:00:00 2001 From: openGaussDev Date: Thu, 3 Mar 2022 22:00:35 +0800 Subject: [PATCH] fix parallel decoding visibility bug Offering: openGaussDev More detail: parallel decoding fix physical addressing info bug. Match-id-491e37c4587a09f855ba3022206f5aaae7a8831f --- src/common/backend/utils/cache/relcache.cpp | 2 +- src/gausskernel/storage/access/transam/transam.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/backend/utils/cache/relcache.cpp b/src/common/backend/utils/cache/relcache.cpp index 822431120..be1b965a4 100644 --- a/src/common/backend/utils/cache/relcache.cpp +++ b/src/common/backend/utils/cache/relcache.cpp @@ -2456,7 +2456,7 @@ void RelationInitPhysicalAddr(Relation relation) * tables and on user tables declared as additional catalog * tables. */ - if (HistoricSnapshotActive() && RelationIsAccessibleInLogicalDecoding(relation) && IsTransactionState()) { + if (HistoricSnapshotActive() && RelationIsAccessibleInLogicalDecoding(relation)) { HeapTuple phys_tuple; Form_pg_class physrel; diff --git a/src/gausskernel/storage/access/transam/transam.cpp b/src/gausskernel/storage/access/transam/transam.cpp index d68a0d04f..cdfe36e31 100644 --- a/src/gausskernel/storage/access/transam/transam.cpp +++ b/src/gausskernel/storage/access/transam/transam.cpp @@ -74,7 +74,7 @@ CommitSeqNo TransactionIdGetCommitSeqNo(TransactionId transactionId, bool isComm * Before going to the commit log manager, check our single item cache to * see if we didn't just check the transaction status a moment ago. */ - if ((snapshot == NULL || !IsVersionMVCCSnapshot(snapshot)) && + if ((snapshot == NULL || (!IsVersionMVCCSnapshot(snapshot) && !(snapshot->satisfies == SNAPSHOT_DECODE_MVCC))) && TransactionIdEquals(transactionId, t_thrd.xact_cxt.cachedFetchCSNXid)) { t_thrd.xact_cxt.latestFetchCSNXid = t_thrd.xact_cxt.cachedFetchCSNXid; t_thrd.xact_cxt.latestFetchCSN = t_thrd.xact_cxt.cachedFetchCSN; @@ -98,15 +98,15 @@ RETRY: * If the XID is older than RecentGlobalXmin, check the clog. Otherwise * check the csnlog. */ - if (!isMvcc || GTM_LITE_MODE) { + if (snapshot != NULL && snapshot->satisfies == SNAPSHOT_DECODE_MVCC) { + xid = GetReplicationSlotCatalogXmin(); + } else if (!isMvcc || GTM_LITE_MODE) { TransactionId recentGlobalXmin = pg_atomic_read_u64(&t_thrd.xact_cxt.ShmemVariableCache->recentGlobalXmin); if (!TransactionIdIsValid(recentGlobalXmin)) { xid = t_thrd.xact_cxt.ShmemVariableCache->recentLocalXmin; } else { xid = recentGlobalXmin; } - } else if (snapshot != NULL && snapshot->satisfies == SNAPSHOT_DECODE_MVCC) { - xid = GetReplicationSlotCatalogXmin(); } else if (snapshot != NULL && IsMVCCSnapshot(snapshot)) { xid = snapshot->xmin; } else {