aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-06-18 05:21:09 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-06-18 05:21:09 +0000
commit66b098492e62667bd20e8745de7bde9d00851147 (patch)
tree8b867c0e46aef5a8cf504f6f704aa842eb668ced
parent25f8916137879110e18fa457dde14bcb18d3f49d (diff)
downloadpostgresql-66b098492e62667bd20e8745de7bde9d00851147.tar.gz
postgresql-66b098492e62667bd20e8745de7bde9d00851147.zip
Dept. of second thoughts: regular COMMIT deletes deletable files before
releasing locks, so COMMIT PREPARED should too.
-rw-r--r--src/backend/access/transam/twophase.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 01cc50a6a46..388d9352ce9 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.1 2005/06/17 22:32:42 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.2 2005/06/18 05:21:09 tgl Exp $
*
* NOTES
* Each global transaction is associated with a global transaction
@@ -1114,13 +1114,11 @@ FinishPreparedTransaction(char *gid, bool isCommit)
*/
gxact->valid = false;
- if (isCommit)
- ProcessRecords(bufptr, xid, twophase_postcommit_callbacks);
- else
- ProcessRecords(bufptr, xid, twophase_postabort_callbacks);
-
/*
- * We also have to remove any files that were supposed to be dropped.
+ * We have to remove any files that were supposed to be dropped.
+ * For consistency with the regular xact.c code paths, must do this
+ * before releasing locks, so do it before running the callbacks.
+ *
* NB: this code knows that we couldn't be dropping any temp rels ...
*/
if (isCommit)
@@ -1134,6 +1132,12 @@ FinishPreparedTransaction(char *gid, bool isCommit)
smgrdounlink(smgropen(abortrels[i]), false, false);
}
+ /* And now do the callbacks */
+ if (isCommit)
+ ProcessRecords(bufptr, xid, twophase_postcommit_callbacks);
+ else
+ ProcessRecords(bufptr, xid, twophase_postabort_callbacks);
+
pgstat_count_xact_commit();
/*