File tree Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -2098,7 +2098,8 @@ StartTransaction(void)
2098
2098
VirtualTransactionId vxid ;
2099
2099
2100
2100
//maxLSN = XLogGetMaxLSN(NULL);
2101
- maxLSN = GetInsertRecPtr ();
2101
+ //maxLSN = GetXLogInsertRecPtr();
2102
+ maxLSN = GetCurrentSnapshotLSN ();
2102
2103
//elog(INFO, "maxlsn init");
2103
2104
2104
2105
/*
Original file line number Diff line number Diff line change @@ -2095,7 +2095,6 @@ GetSnapshotDataInitOldSnapshot(Snapshot snapshot)
2095
2095
* If not using "snapshot too old" feature, fill related fields with
2096
2096
* dummy values that don't require any locking.
2097
2097
*/
2098
- snapshot -> lsn = InvalidXLogRecPtr ;
2099
2098
snapshot -> whenTaken = 0 ;
2100
2099
}
2101
2100
else
@@ -2105,10 +2104,11 @@ GetSnapshotDataInitOldSnapshot(Snapshot snapshot)
2105
2104
* snapshot becomes old enough to need to fall back on the special
2106
2105
* "old snapshot" logic.
2107
2106
*/
2108
- snapshot -> lsn = GetXLogInsertRecPtr ();
2109
2107
snapshot -> whenTaken = GetSnapshotCurrentTimestamp ();
2110
2108
MaintainOldSnapshotTimeMapping (snapshot -> whenTaken , snapshot -> xmin );
2111
2109
}
2110
+
2111
+ snapshot -> lsn = GetXLogInsertRecPtr ();
2112
2112
}
2113
2113
2114
2114
/*
Original file line number Diff line number Diff line change @@ -499,6 +499,19 @@ SnapshotSetCommandId(CommandId curcid)
499
499
/* Should we do the same with CatalogSnapshot? */
500
500
}
501
501
502
+ /*
503
+ * GetCurrentSnapshotLSN
504
+ * Propagate CommandCounterIncrement into the static snapshots, if set
505
+ */
506
+ XLogRecPtr
507
+ GetCurrentSnapshotLSN ()
508
+ {
509
+ if (CurrentSnapshot )
510
+ return CurrentSnapshot -> lsn ;
511
+
512
+ return InvalidXLogRecPtr ;
513
+ }
514
+
502
515
/*
503
516
* SetTransactionSnapshot
504
517
* Set the transaction's snapshot from an imported MVCC snapshot.
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ OldSnapshotThresholdActive(void)
106
106
extern Snapshot GetTransactionSnapshot (void );
107
107
extern Snapshot GetLatestSnapshot (void );
108
108
extern void SnapshotSetCommandId (CommandId curcid );
109
+ extern XLogRecPtr GetCurrentSnapshotLSN ();
109
110
extern Snapshot GetOldestSnapshot (void );
110
111
111
112
extern Snapshot GetCatalogSnapshot (Oid relid );
You can’t perform that action at this time.
0 commit comments