Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcd0ceba

Browse files
Always SnapshotResetXmin() during ClearTransaction()
Avoid corner cases during 2PC with6bad580
1 parent3217327 commitcd0ceba

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

‎src/backend/access/transam/xact.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2640,7 +2640,7 @@ CleanupTransaction(void)
26402640
* do abort cleanup processing
26412641
*/
26422642
AtCleanup_Portals();/* now safe to release portal memory */
2643-
AtEOXact_Snapshot(false,false);/* and release the transaction's snapshots */
2643+
AtEOXact_Snapshot(false,true);/* and release the transaction's snapshots */
26442644

26452645
CurrentResourceOwner=NULL;/* and resource owner */
26462646
if (TopTransactionResourceOwner)

‎src/backend/utils/time/snapmgr.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ AtSubAbort_Snapshot(int level)
10511051
*Snapshot manager's cleanup function for end of transaction
10521052
*/
10531053
void
1054-
AtEOXact_Snapshot(boolisCommit,boolisPrepare)
1054+
AtEOXact_Snapshot(boolisCommit,boolresetXmin)
10551055
{
10561056
/*
10571057
* In transaction-snapshot mode we must release our privately-managed
@@ -1137,16 +1137,15 @@ AtEOXact_Snapshot(bool isCommit, bool isPrepare)
11371137
FirstSnapshotSet= false;
11381138

11391139
/*
1140-
* During normal commit and abort processing, we call
1141-
* ProcArrayEndTransaction() or ProcArrayClearTransaction() to
1142-
* reset the PgXact->xmin. That call happens prior to the call to
1143-
* AtEOXact_Snapshot(), so we need not touch xmin here at all,
1144-
* accept when we are preparing a transaction.
1140+
* During normal commit processing, we call
1141+
* ProcArrayEndTransaction() to reset the PgXact->xmin. That call
1142+
* happens prior to the call to AtEOXact_Snapshot(), so we need
1143+
* not touch xmin here at all.
11451144
*/
1146-
if (isPrepare)
1145+
if (resetXmin)
11471146
SnapshotResetXmin();
11481147

1149-
Assert(isPrepare||MyPgXact->xmin==0);
1148+
Assert(resetXmin||MyPgXact->xmin==0);
11501149
}
11511150

11521151

‎src/include/utils/snapmgr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ extern void UnregisterSnapshotFromOwner(Snapshot snapshot, ResourceOwner owner);
8585

8686
externvoidAtSubCommit_Snapshot(intlevel);
8787
externvoidAtSubAbort_Snapshot(intlevel);
88-
externvoidAtEOXact_Snapshot(boolisCommit,boolisPrepare);
88+
externvoidAtEOXact_Snapshot(boolisCommit,boolresetXmin);
8989

9090
externvoidImportSnapshot(constchar*idstr);
9191
externboolXactHasExportedSnapshots(void);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp