diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c index f580c0b461..e540186145 100644 --- a/src/backend/utils/time/tqual.c +++ b/src/backend/utils/time/tqual.c @@ -31,7 +31,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/time/tqual.c,v 1.105 2007/09/08 20:31:15 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/time/tqual.c,v 1.106 2007/09/21 18:24:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -219,16 +219,14 @@ HeapTupleSatisfiesSelf(HeapTupleHeader tuple, Snapshot snapshot, Buffer buffer) Assert(!(tuple->t_infomask & HEAP_XMAX_IS_MULTI)); - /* deleting subtransaction aborted? */ - if (TransactionIdDidAbort(HeapTupleHeaderGetXmax(tuple))) + if (!TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(tuple))) { + /* deleting subtransaction must have aborted */ SetHintBits(tuple, buffer, HEAP_XMAX_INVALID, InvalidTransactionId); return true; } - Assert(TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(tuple))); - return false; } else if (TransactionIdIsInProgress(HeapTupleHeaderGetXmin(tuple))) @@ -395,16 +393,14 @@ HeapTupleSatisfiesNow(HeapTupleHeader tuple, Snapshot snapshot, Buffer buffer) Assert(!(tuple->t_infomask & HEAP_XMAX_IS_MULTI)); - /* deleting subtransaction aborted? */ - if (TransactionIdDidAbort(HeapTupleHeaderGetXmax(tuple))) + if (!TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(tuple))) { + /* deleting subtransaction must have aborted */ SetHintBits(tuple, buffer, HEAP_XMAX_INVALID, InvalidTransactionId); return true; } - Assert(TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(tuple))); - if (HeapTupleHeaderGetCmax(tuple) >= GetCurrentCommandId()) return true; /* deleted after scan started */ else @@ -640,16 +636,14 @@ HeapTupleSatisfiesUpdate(HeapTupleHeader tuple, CommandId curcid, Assert(!(tuple->t_infomask & HEAP_XMAX_IS_MULTI)); - /* deleting subtransaction aborted? */ - if (TransactionIdDidAbort(HeapTupleHeaderGetXmax(tuple))) + if (!TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(tuple))) { + /* deleting subtransaction must have aborted */ SetHintBits(tuple, buffer, HEAP_XMAX_INVALID, InvalidTransactionId); return HeapTupleMayBeUpdated; } - Assert(TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(tuple))); - if (HeapTupleHeaderGetCmax(tuple) >= curcid) return HeapTupleSelfUpdated; /* updated after scan started */ else @@ -806,16 +800,14 @@ HeapTupleSatisfiesDirty(HeapTupleHeader tuple, Snapshot snapshot, Assert(!(tuple->t_infomask & HEAP_XMAX_IS_MULTI)); - /* deleting subtransaction aborted? */ - if (TransactionIdDidAbort(HeapTupleHeaderGetXmax(tuple))) + if (!TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(tuple))) { + /* deleting subtransaction must have aborted */ SetHintBits(tuple, buffer, HEAP_XMAX_INVALID, InvalidTransactionId); return true; } - Assert(TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(tuple))); - return false; } else if (TransactionIdIsInProgress(HeapTupleHeaderGetXmin(tuple))) @@ -970,17 +962,14 @@ HeapTupleSatisfiesMVCC(HeapTupleHeader tuple, Snapshot snapshot, Assert(!(tuple->t_infomask & HEAP_XMAX_IS_MULTI)); - /* deleting subtransaction aborted? */ - /* FIXME -- is this correct w.r.t. the cmax of the tuple? */ - if (TransactionIdDidAbort(HeapTupleHeaderGetXmax(tuple))) + if (!TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(tuple))) { + /* deleting subtransaction must have aborted */ SetHintBits(tuple, buffer, HEAP_XMAX_INVALID, InvalidTransactionId); return true; } - Assert(TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(tuple))); - if (HeapTupleHeaderGetCmax(tuple) >= snapshot->curcid) return true; /* deleted after scan started */ else