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 */
11151115gxact -> 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 */
11261124if (isCommit )
@@ -1134,6 +1132,12 @@ FinishPreparedTransaction(char *gid, bool isCommit)
11341132smgrdounlink (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+
11371141pgstat_count_xact_commit ();
11381142
11391143/*