fix parallel decoding visibility bug

Offering: openGaussDev

More detail: parallel decoding fix physical addressing info bug.

Match-id-491e37c4587a09f855ba3022206f5aaae7a8831f
This commit is contained in:
openGaussDev
2022-03-03 22:00:35 +08:00
committed by yanghao
parent f602677e45
commit b6fb01e80e
2 changed files with 5 additions and 5 deletions

View File

@ -2456,7 +2456,7 @@ void RelationInitPhysicalAddr(Relation relation)
* tables and on user tables declared as additional catalog * tables and on user tables declared as additional catalog
* tables. * tables.
*/ */
if (HistoricSnapshotActive() && RelationIsAccessibleInLogicalDecoding(relation) && IsTransactionState()) { if (HistoricSnapshotActive() && RelationIsAccessibleInLogicalDecoding(relation)) {
HeapTuple phys_tuple; HeapTuple phys_tuple;
Form_pg_class physrel; Form_pg_class physrel;

View File

@ -74,7 +74,7 @@ CommitSeqNo TransactionIdGetCommitSeqNo(TransactionId transactionId, bool isComm
* Before going to the commit log manager, check our single item cache to * 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. * 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)) { TransactionIdEquals(transactionId, t_thrd.xact_cxt.cachedFetchCSNXid)) {
t_thrd.xact_cxt.latestFetchCSNXid = 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; 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 * If the XID is older than RecentGlobalXmin, check the clog. Otherwise
* check the csnlog. * 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); TransactionId recentGlobalXmin = pg_atomic_read_u64(&t_thrd.xact_cxt.ShmemVariableCache->recentGlobalXmin);
if (!TransactionIdIsValid(recentGlobalXmin)) { if (!TransactionIdIsValid(recentGlobalXmin)) {
xid = t_thrd.xact_cxt.ShmemVariableCache->recentLocalXmin; xid = t_thrd.xact_cxt.ShmemVariableCache->recentLocalXmin;
} else { } else {
xid = recentGlobalXmin; xid = recentGlobalXmin;
} }
} else if (snapshot != NULL && snapshot->satisfies == SNAPSHOT_DECODE_MVCC) {
xid = GetReplicationSlotCatalogXmin();
} else if (snapshot != NULL && IsMVCCSnapshot(snapshot)) { } else if (snapshot != NULL && IsMVCCSnapshot(snapshot)) {
xid = snapshot->xmin; xid = snapshot->xmin;
} else { } else {