Skip to content

Commit 66b0984

Browse files
committed
Dept. of second thoughts: regular COMMIT deletes deletable files before
releasing locks, so COMMIT PREPARED should too.
1 parent 25f8916 commit 66b0984

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/backend/access/transam/twophase.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.1 2005/06/17 22:32:42 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.2 2005/06/18 05:21:09 tgl Exp $
1111
*
1212
* NOTES
1313
* Each global transaction is associated with a global transaction
@@ -1114,13 +1114,11 @@ FinishPreparedTransaction(char *gid, bool isCommit)
11141114
*/
11151115
gxact->valid = false;
11161116

1117-
if (isCommit)
1118-
ProcessRecords(bufptr, xid, twophase_postcommit_callbacks);
1119-
else
1120-
ProcessRecords(bufptr, xid, twophase_postabort_callbacks);
1121-
11221117
/*
1123-
* We also have to remove any files that were supposed to be dropped.
1118+
* We have to remove any files that were supposed to be dropped.
1119+
* For consistency with the regular xact.c code paths, must do this
1120+
* before releasing locks, so do it before running the callbacks.
1121+
*
11241122
* NB: this code knows that we couldn't be dropping any temp rels ...
11251123
*/
11261124
if (isCommit)
@@ -1134,6 +1132,12 @@ FinishPreparedTransaction(char *gid, bool isCommit)
11341132
smgrdounlink(smgropen(abortrels[i]), false, false);
11351133
}
11361134

1135+
/* And now do the callbacks */
1136+
if (isCommit)
1137+
ProcessRecords(bufptr, xid, twophase_postcommit_callbacks);
1138+
else
1139+
ProcessRecords(bufptr, xid, twophase_postabort_callbacks);
1140+
11371141
pgstat_count_xact_commit();
11381142

11391143
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy