@@ -1287,6 +1287,7 @@ getMaxLSNFromSnapshot()
1287
1287
1288
1288
//cur = GetActiveSnapshot();
1289
1289
cur = GetLatestSnapshot ();
1290
+ //cur = GetTransactionSnapshot();
1290
1291
if (cur == NULL )
1291
1292
elog (ERROR , "no active snapshot set" );
1292
1293
@@ -1418,7 +1419,7 @@ RecordTransactionCommit(void)
1418
1419
*/
1419
1420
if (!wrote_xlog && synchronous_commit > SYNCHRONOUS_COMMIT_OFF )
1420
1421
{
1421
- XLogRecPtr XLogMaxLSN = XLogGetMaxLSN (NULL );
1422
+ // XLogRecPtr XLogMaxLSN = XLogGetMaxLSN(NULL);
1422
1423
//XLogRecPtr walSndAppliedLSN = SyncRepGetWalSndLSN();
1423
1424
//XLogRecPtr RecentFlushPtr = InvalidXLogRecPtr;
1424
1425
//if (!RecoveryInProgress())
@@ -1441,12 +1442,13 @@ RecordTransactionCommit(void)
1441
1442
//LWLockRelease(SyncRepLock);
1442
1443
1443
1444
XLogRecPtr remoteFlushLSN = ((volatile WalSndCtlData * ) WalSndCtl )-> lsn [Min (synchronous_commit , SYNC_REP_WAIT_APPLY )];
1444
- elog ( INFO , "lsn from snapshot = (%d)" , getMaxLSNFromSnapshot () );
1445
+ XLogRecPtr maxSnapshotLSN = getMaxLSNFromSnapshot ();
1445
1446
//elog(INFO, "maxlsn = (%d), remotelsn = (%d)", XLogMaxLSN, remoteFlushLSN);
1446
1447
1447
- if ((XLogMaxLSN > remoteFlushLSN ) && (remoteFlushLSN != 0 ))
1448
+ //if((XLogMaxLSN > remoteFlushLSN) && (remoteFlushLSN != 0))
1449
+ if ((maxSnapshotLSN > remoteFlushLSN ) && (maxSnapshotLSN != 0 ))
1448
1450
{
1449
- SyncRepWaitForLSN (XLogMaxLSN , false);
1451
+ SyncRepWaitForLSN (maxSnapshotLSN , false);
1450
1452
//elog(INFO, "RO finished waiting for syncrepwaitforlsn!");
1451
1453
}
1452
1454
//elog(INFO, "RO txn maxLSN = (%d), RecntFlushPtr value = (%d), XactMaxLSN = (%d)", XLogMaxLSN, RecentFlushPtr, XactMaxLSN);
@@ -1557,15 +1559,15 @@ RecordTransactionCommit(void)
1557
1559
synchronous_commit > SYNCHRONOUS_COMMIT_OFF ) ||
1558
1560
forceSyncCommit || nrels > 0 )
1559
1561
{
1560
- XLogRecPtr maxLSN = XLogGetMaxLSN (0 );
1562
+ // XLogRecPtr maxLSN = XLogGetMaxLSN(0);
1561
1563
//elog(INFO, "XactLastRecEnd=(%d), maxLSN=(%d), WalSndCtl->lsn[mode]=(%d, %d, %d)", XactLastRecEnd, maxLSN, WalSndCtl->lsn[0], WalSndCtl->lsn[1], WalSndCtl->lsn[2]);
1562
1564
XLogFlush (XactLastRecEnd );
1563
1565
1564
1566
/*
1565
1567
* Now we may update the CLOG, if we wrote a COMMIT record above
1566
1568
*/
1567
1569
if (markXidCommitted )
1568
- TransactionIdCommitTree (xid , nchildren , children );
1570
+ TransactionIdCommitTree (xid , nchildren , children , XactLastRecEnd );
1569
1571
}
1570
1572
else
1571
1573
{
@@ -2382,6 +2384,13 @@ CommitTransaction(void)
2382
2384
*/
2383
2385
ProcArrayEndTransaction (MyProc , latestXid );
2384
2386
2387
+ //TransactionId xid = GetTopTransactionIdIfAny();
2388
+ //bool markXidCommitted = TransactionIdIsValid(xid);
2389
+ //bool wrote_xlog = (XactLastCommitEnd != 0);
2390
+
2391
+ //if (wrote_xlog && markXidCommitted)
2392
+ // SyncRepWaitForLSN(XactLastCommitEnd, true);
2393
+
2385
2394
/*
2386
2395
* This is all post-commit cleanup. Note that if an error is raised here,
2387
2396
* it's too late to abort the transaction. This should be just
@@ -6048,7 +6057,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
6048
6057
/*
6049
6058
* Mark the transaction committed in pg_xact.
6050
6059
*/
6051
- TransactionIdCommitTree (xid , parsed -> nsubxacts , parsed -> subxacts );
6060
+ TransactionIdCommitTree (xid , parsed -> nsubxacts , parsed -> subxacts , lsn );
6052
6061
}
6053
6062
else
6054
6063
{
0 commit comments