aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-04-04 18:20:22 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-04-04 18:24:43 +0300
commita2f9572ca507bfcb71bcf1b81b563e5094fd6904 (patch)
tree11a752bab415eafd03f598cfac3d49390d4fd1ea /src/backend/access
parent1891a4b6b8ad2bcdd290380a89cbb4dc160adbb8 (diff)
downloadpostgresql-a2f9572ca507bfcb71bcf1b81b563e5094fd6904.tar.gz
postgresql-a2f9572ca507bfcb71bcf1b81b563e5094fd6904.zip
Move multixid allocation out of critical section.
It can fail if you run out of memory. This call was added in 9.3, so backpatch to 9.3 only.
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/heap/heapam.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index d94980bbc16..9283b70a420 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -2717,6 +2717,21 @@ l1:
/* replace cid with a combo cid if necessary */
HeapTupleHeaderAdjustCmax(tp.t_data, &cid, &iscombo);
+ /*
+ * If this is the first possibly-multixact-able operation in the current
+ * transaction, set my per-backend OldestMemberMXactId setting. We can be
+ * certain that the transaction will never become a member of any older
+ * MultiXactIds than that. (We have to do this even if we end up just
+ * using our own TransactionId below, since some other backend could
+ * incorporate our XID into a MultiXact immediately afterwards.)
+ */
+ MultiXactIdSetOldestMember();
+
+ compute_new_xmax_infomask(HeapTupleHeaderGetRawXmax(tp.t_data),
+ tp.t_data->t_infomask, tp.t_data->t_infomask2,
+ xid, LockTupleExclusive, true,
+ &new_xmax, &new_infomask, &new_infomask2);
+
START_CRIT_SECTION();
/*
@@ -2736,21 +2751,6 @@ l1:
vmbuffer);
}
- /*
- * If this is the first possibly-multixact-able operation in the current
- * transaction, set my per-backend OldestMemberMXactId setting. We can be
- * certain that the transaction will never become a member of any older
- * MultiXactIds than that. (We have to do this even if we end up just
- * using our own TransactionId below, since some other backend could
- * incorporate our XID into a MultiXact immediately afterwards.)
- */
- MultiXactIdSetOldestMember();
-
- compute_new_xmax_infomask(HeapTupleHeaderGetRawXmax(tp.t_data),
- tp.t_data->t_infomask, tp.t_data->t_infomask2,
- xid, LockTupleExclusive, true,
- &new_xmax, &new_infomask, &new_infomask2);
-
/* store transaction information of xact deleting the tuple */
tp.t_data->t_infomask &= ~(HEAP_XMAX_BITS | HEAP_MOVED);
tp.t_data->t_infomask2 &= ~HEAP_KEYS_UPDATED;