@@ -1427,7 +1427,7 @@ RecordTransactionCommit(void)
1427
1427
if (!wrote_xlog && synchronous_commit > SYNCHRONOUS_COMMIT_OFF )
1428
1428
{
1429
1429
//XLogRecPtr XLogMaxLSN = XLogGetMaxLSN(NULL);
1430
- maxLSN = XLogGetMaxLSN (NULL );
1430
+ // maxLSN = XLogGetMaxLSN(NULL);
1431
1431
//XLogRecPtr walSndAppliedLSN = SyncRepGetWalSndLSN();
1432
1432
//XLogRecPtr RecentFlushPtr = InvalidXLogRecPtr;
1433
1433
//if (!RecoveryInProgress())
@@ -1446,14 +1446,17 @@ RecordTransactionCommit(void)
1446
1446
//else
1447
1447
// elog(INFO, "queue empty");
1448
1448
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 )] ));
1450
1450
//LWLockRelease(SyncRepLock);
1451
1451
1452
1452
XLogRecPtr remoteFlushLSN = ((volatile WalSndCtlData * ) WalSndCtl )-> lsn [Min (synchronous_commit , SYNC_REP_WAIT_APPLY )];
1453
1453
//XLogRecPtr maxSnapshotLSN = getMaxLSNFromSnapshot();
1454
1454
//XLogRecPtr maxSnapshotLSN = TransactionIdGetCommitLSN(MyProc->xmin);
1455
1455
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 )
1457
1460
SyncRepWaitForLSN (maxLSN , false);
1458
1461
}
1459
1462
if (!wrote_xlog )
@@ -2091,7 +2094,7 @@ StartTransaction(void)
2091
2094
TransactionState s ;
2092
2095
VirtualTransactionId vxid ;
2093
2096
2094
- // maxLSN = XLogGetMaxLSN(NULL);
2097
+ maxLSN = XLogGetMaxLSN (NULL );
2095
2098
//elog(INFO, "maxlsn init");
2096
2099
2097
2100
/*
0 commit comments