summaryrefslogtreecommitdiff
path: root/src/backend/access/heap/pruneheap.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2013-11-29 16:08:06 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2013-11-29 21:47:21 -0300
commit1ce150b7bb14105ddc190c5f1acf2ae1a9b2854a (patch)
treedd072a896cb56b945a500c9ce1e5dfff8bd1d954 /src/backend/access/heap/pruneheap.c
parent1df0122daa6510eed4146033379a5055f66f5a8e (diff)
Don't TransactionIdDidAbort in HeapTupleGetUpdateXid
It is dangerous to do so, because some code expects to be able to see what's the true Xmax even if it is aborted (particularly while traversing HOT chains). So don't do it, and instead rely on the callers to verify for abortedness, if necessary. Several race conditions and bugs fixed in the process. One isolation test changes the expected output due to these. This also reverts commit c235a6a589b, which is no longer necessary. Backpatch to 9.3, where this function was introduced. Andres Freund
Diffstat (limited to 'src/backend/access/heap/pruneheap.c')
-rw-r--r--src/backend/access/heap/pruneheap.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c
index fdfa37c39c4..4dada6b6d45 100644
--- a/src/backend/access/heap/pruneheap.c
+++ b/src/backend/access/heap/pruneheap.c
@@ -479,22 +479,12 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
break;
case HEAPTUPLE_DELETE_IN_PROGRESS:
- {
- TransactionId xmax;
-
- /*
- * This tuple may soon become DEAD. Update the hint field
- * so that the page is reconsidered for pruning in future.
- * If there was a MultiXactId updater, and it aborted after
- * HTSV checked, then we will get an invalid Xid here.
- * There is no need for future pruning of the page in that
- * case, so skip it.
- */
- xmax = HeapTupleHeaderGetUpdateXid(htup);
- if (TransactionIdIsValid(xmax))
- heap_prune_record_prunable(prstate, xmax);
- }
-
+ /*
+ * This tuple may soon become DEAD. Update the hint field
+ * so that the page is reconsidered for pruning in future.
+ */
+ heap_prune_record_prunable(prstate,
+ HeapTupleHeaderGetUpdateXid(htup));
break;
case HEAPTUPLE_LIVE: