forked from huawei/openGauss-server
!131 fix csnlog cannot be found that occur in standby node, and remove the Warning log in InternalGetCommitSeqNo.
Merge pull request !131 from xiong_xjun/master
This commit is contained in:
commit
3fe482fd3c
|
|
@ -413,27 +413,6 @@ static CommitSeqNo InternalGetCommitSeqNo(TransactionId xid)
|
|||
int slotno;
|
||||
CommitSeqNo csn;
|
||||
|
||||
/* Can't ask about stuff that might not be around anymore */
|
||||
TransactionId currGlobalXmin = pg_atomic_read_u64(&t_thrd.xact_cxt.ShmemVariableCache->recentGlobalXmin);
|
||||
|
||||
#ifdef ENABLE_MULTIPLE_NODES
|
||||
if (TransactionIdPrecedes(xid, currGlobalXmin))
|
||||
#else
|
||||
if (TransactionIdPrecedes(xid, currGlobalXmin) && !RecoveryInProgress())
|
||||
#endif
|
||||
{
|
||||
ereport(WARNING,
|
||||
(errcode(ERRCODE_SNAPSHOT_INVALID),
|
||||
(errmsg("Snapshot too old when read CSN, this is a safe error"
|
||||
"if there is breakdown in gtm of CN log"),
|
||||
errdetail("current xid %lu is lower than "
|
||||
"recentGlobalXmin: %lu",
|
||||
xid,
|
||||
currGlobalXmin),
|
||||
errhint("This is a safe error report, will not impact "
|
||||
"data consistency, retry your query if needed."))));
|
||||
}
|
||||
|
||||
if (!TransactionIdIsNormal(xid)) {
|
||||
if (xid == InvalidTransactionId)
|
||||
return COMMITSEQNO_ABORTED;
|
||||
|
|
|
|||
|
|
@ -11014,7 +11014,13 @@ bool CreateRestartPoint(int flags)
|
|||
*/
|
||||
if (!g_instance.attr.attr_storage.enableIncrementalCheckpoint ||
|
||||
elapsed_secs >= u_sess->attr.attr_storage.fullCheckPointTimeout) {
|
||||
TruncateCSNLOG(GetOldestXmin(NULL));
|
||||
TransactionId globalXmin = InvalidTransactionId;
|
||||
(void)GetOldestActiveTransactionId(&globalXmin);
|
||||
TransactionId cutoff_xid = GetOldestXmin(NULL);
|
||||
if (TransactionIdIsNormal(globalXmin) && TransactionIdPrecedes(globalXmin, cutoff_xid)) {
|
||||
cutoff_xid = globalXmin;
|
||||
}
|
||||
TruncateCSNLOG(cutoff_xid);
|
||||
t_thrd.checkpoint_cxt.last_truncate_log_time = now;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2050,8 +2050,6 @@ TransactionId GetOldestActiveTransactionId(TransactionId *globalXmin)
|
|||
TransactionIdAdvance(xmax);
|
||||
TransactionId xmin = xmax;
|
||||
|
||||
Assert(!RecoveryInProgress());
|
||||
|
||||
LWLockAcquire(ProcArrayLock, LW_SHARED);
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue