10000 Moved maxlsn back to txn start · pct960/postgres@c7dd4ab · GitHub
[go: up one dir, main page]

Skip to content

Commit c7dd4ab

Browse files
committed
Moved maxlsn back to txn start
using shmqueue to decide whether to add txn to wait queue
1 parent 322c7dc commit c7dd4ab

File tree

1 file changed

+7
-4
lines changed
  • src/backend/access/transam

1 file changed

+7
-4
lines changed

src/backend/access/transam/xact.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ RecordTransactionCommit(void)
14271427
if (!wrote_xlog && synchronous_commit > SYNCHRONOUS_COMMIT_OFF)
14281428
{
14291429
//XLogRecPtr XLogMaxLSN = XLogGetMaxLSN(NULL);
1430-
maxLSN = XLogGetMaxLSN(NULL);
1430+
//maxLSN = XLogGetMaxLSN(NULL);
14311431
//XLogRecPtr walSndAppliedLSN = SyncRepGetWalSndLSN();
14321432
//XLogRecPtr RecentFlushPtr = InvalidXLogRecPtr;
14331433
//if (!RecoveryInProgress())
@@ -1446,14 +1446,17 @@ RecordTransactionCommit(void)
14461446
//else
14471447
// elog(INFO, "queue empty");
14481448

1449-
//elog(INFO, "Queue empty? = (%d)", SHMQueueEmpty(&(WalSndCtl->SyncRepQueue[Min(synchronous_commit, SYNC_REP_WAIT_FLUSH)])));
1449+
bool queueEmpty = SHMQueueEmpty(&(WalSndCtl->SyncRepQueue[Min(synchronous_commit, SYNC_REP_WAIT_APPLY)]));
14501450
//LWLockRelease(SyncRepLock);
14511451

14521452
XLogRecPtr remoteFlushLSN = ((volatile WalSndCtlData *) WalSndCtl)->lsn[Min(synchronous_commit, SYNC_REP_WAIT_APPLY)];
14531453
//XLogRecPtr maxSnapshotLSN = getMaxLSNFromSnapshot();
14541454
//XLogRecPtr maxSnapshotLSN = TransactionIdGetCommitLSN(MyProc->xmin);
14551455

1456-
if((maxLSN > remoteFlushLSN) && (remoteFlushLSN != 0))
1456+
//elog(INFO, "maxLSN = (%d), remoteflushlsn = (%d), active backends = (%d)", maxLSN, remoteFlushLSN, MinimumActiveBackends(1));
1457+
1458+
//if((maxLSN > remoteFlushLSN) && (remoteFlushLSN != 0))
1459+
if((maxLSN > remoteFlushLSN) && !queueEmpty)
14571460
SyncRepWaitForLSN(maxLSN, false);
14581461
}
14591462
if (!wrote_xlog)
@@ -2091,7 +2094,7 @@ StartTransaction(void)
20912094
TransactionState s;
20922095
VirtualTransactionId vxid;
20932096

2094-
//maxLSN = XLogGetMaxLSN(NULL);
2097+
maxLSN = XLogGetMaxLSN(NULL);
20952098
//elog(INFO, "maxlsn init");
20962099

20972100
/*

0 commit comments

Comments
 (0)
0