diff options
Diffstat (limited to 'src/backend/access/heap')
| -rw-r--r-- | src/backend/access/heap/heapam.c | 21 | ||||
| -rw-r--r-- | src/backend/access/heap/pruneheap.c | 22 |
2 files changed, 16 insertions, 27 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 31496a3063..31518d58bf 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -3181,7 +3181,11 @@ l2: if (!HEAP_XMAX_IS_LOCKED_ONLY(oldtup.t_data->t_infomask)) update_xact = HeapTupleGetUpdateXid(oldtup.t_data); - /* there was no UPDATE in the MultiXact; or it aborted. */ + /* + * There was no UPDATE in the MultiXact; or it aborted. No + * TransactionIdIsInProgress() call needed here, since we called + * MultiXactIdWait() above. + */ if (!TransactionIdIsValid(update_xact) || TransactionIdDidAbort(update_xact)) can_continue = true; @@ -5441,6 +5445,9 @@ GetMultiXactIdHintBits(MultiXactId multi, uint16 *new_infomask, * Given a multixact Xmax and corresponding infomask, which does not have the * HEAP_XMAX_LOCK_ONLY bit set, obtain and return the Xid of the updating * transaction. + * + * Caller is expected to check the status of the updating transaction, if + * necessary. */ static TransactionId MultiXactIdGetUpdateXid(TransactionId xmax, uint16 t_infomask) @@ -5465,19 +5472,11 @@ MultiXactIdGetUpdateXid(TransactionId xmax, uint16 t_infomask) for (i = 0; i < nmembers; i++) { /* Ignore lockers */ - if (members[i].status == MultiXactStatusForKeyShare || - members[i].status == MultiXactStatusForShare || - members[i].status == MultiXactStatusForNoKeyUpdate || - members[i].status == MultiXactStatusForUpdate) + if (!ISUPDATE_from_mxstatus(members[i].status)) continue; - /* ignore aborted transactions */ - if (TransactionIdDidAbort(members[i].xid)) - continue; - /* there should be at most one non-aborted updater */ + /* there can be at most one updater */ Assert(update_xact == InvalidTransactionId); - Assert(members[i].status == MultiXactStatusNoKeyUpdate || - members[i].status == MultiXactStatusUpdate); update_xact = members[i].xid; #ifndef USE_ASSERT_CHECKING diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c index fdfa37c39c..4dada6b6d4 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: |
