AtEOXact_ComboCid();
AtEOXact_HashTables(true);
AtEOXact_PgStat(true);
- AtEOXact_Snapshot(true);
+ AtEOXact_Snapshot(true, false);
AtCommit_ApplyLauncher();
pgstat_report_xact_timestamp(0);
AtEOXact_ComboCid();
AtEOXact_HashTables(true);
/* don't call AtEOXact_PgStat here; we fixed pgstat state above */
- AtEOXact_Snapshot(true);
+ AtEOXact_Snapshot(true, true);
pgstat_report_xact_timestamp(0);
CurrentResourceOwner = NULL;
* do abort cleanup processing
*/
AtCleanup_Portals(); /* now safe to release portal memory */
- AtEOXact_Snapshot(false); /* and release the transaction's snapshots */
+ AtEOXact_Snapshot(false, false); /* and release the transaction's snapshots */
CurrentResourceOwner = NULL; /* and resource owner */
if (TopTransactionResourceOwner)
* Snapshot manager's cleanup function for end of transaction
*/
void
-AtEOXact_Snapshot(bool isCommit)
+AtEOXact_Snapshot(bool isCommit, bool isPrepare)
{
/*
* In transaction-snapshot mode we must release our privately-managed
FirstSnapshotSet = false;
- SnapshotResetXmin();
+ /*
+ * During normal commit and abort processing, we call
+ * ProcArrayEndTransaction() or ProcArrayClearTransaction() to
+ * reset the PgXact->xmin. That call happens prior to the call to
+ * AtEOXact_Snapshot(), so we need not touch xmin here at all,
+ * accept when we are preparing a transaction.
+ */
+ if (isPrepare)
+ SnapshotResetXmin();
+
+ Assert(isPrepare || MyPgXact->xmin == 0);
}
extern void AtSubCommit_Snapshot(int level);
extern void AtSubAbort_Snapshot(int level);
-extern void AtEOXact_Snapshot(bool isCommit);
+extern void AtEOXact_Snapshot(bool isCommit, bool isPrepare);
extern void ImportSnapshot(const char *idstr);
extern bool XactHasExportedSnapshots(void);