aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/twophase.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/transam/twophase.c')
-rw-r--r--src/backend/access/transam/twophase.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index f09941d0ecb..4b4999fd7b4 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -2065,11 +2065,15 @@ RecordTransactionCommitPrepared(TransactionId xid,
/* See notes in RecordTransactionCommit */
MyPgXact->delayChkpt = true;
- /* Emit the XLOG commit record */
+ /*
+ * Emit the XLOG commit record. Note that we mark 2PC commits as potentially
+ * having AccessExclusiveLocks since we don't know whether or not they do.
+ */
recptr = XactLogCommitRecord(committs,
nchildren, children, nrels, rels,
ninvalmsgs, invalmsgs,
initfileinval, false,
+ MyXactFlags | XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK,
xid);
@@ -2146,10 +2150,14 @@ RecordTransactionAbortPrepared(TransactionId xid,
START_CRIT_SECTION();
- /* Emit the XLOG abort record */
+ /*
+ * Emit the XLOG commit record. Note that we mark 2PC aborts as potentially
+ * having AccessExclusiveLocks since we don't know whether or not they do.
+ */
recptr = XactLogAbortRecord(GetCurrentTimestamp(),
nchildren, children,
nrels, rels,
+ MyXactFlags | XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK,
xid);
/* Always flush, since we're about to remove the 2PC state file */