aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2013-07-19 18:35:07 -0400
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2013-07-19 18:35:07 -0400
commit0b3859f3b607b375cfabb0a95bb4c58a4c1b37ee (patch)
treee6173c7ae0df34be8f0bb81fd5a88792c63dccc7 /src
parenta9f8fe06bc38c9eb3e99191590713de903a91cfa (diff)
downloadpostgresql-0b3859f3b607b375cfabb0a95bb4c58a4c1b37ee.tar.gz
postgresql-0b3859f3b607b375cfabb0a95bb4c58a4c1b37ee.zip
Fix HeapTupleSatisfiesVacuum on aborted updater xacts
By using only the macro that checks infomask bits HEAP_XMAX_IS_LOCKED_ONLY to verify whether a multixact is not an updater, and not the full HeapTupleHeaderIsOnlyLocked, it would come to the wrong result in case of a multixact containing an aborted update; therefore returning the wrong result code. This would cause predicate.c to break completely (as in bug report #8273 from David Leverton), and certain index builds would misbehave. As far as I can tell, other callers of the bogus routine would make harmless mistakes or not be affected by the difference at all; so this was a pretty narrow case. Also, no other user of the HEAP_XMAX_IS_LOCKED_ONLY macro is as careless; they all check specifically for the HEAP_XMAX_IS_MULTI case, and they all verify whether the updater is InvalidXid before concluding that it's a valid updater. So there doesn't seem to be any similar bug.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/time/tqual.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 55563ea335d..c69ffd306ed 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -1287,7 +1287,9 @@ HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, TransactionId OldestXmin,
{
if (tuple->t_infomask & HEAP_XMAX_INVALID) /* xid invalid */
return HEAPTUPLE_INSERT_IN_PROGRESS;
- if (HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask))
+ /* only locked? run infomask-only check first, for performance */
+ if (HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask) ||
+ HeapTupleHeaderIsOnlyLocked(tuple))
return HEAPTUPLE_INSERT_IN_PROGRESS;
/* inserted and then deleted by same xact */
return HEAPTUPLE_DELETE_IN_PROGRESS;