diff options
author | Kevin Grittner <kgrittn@postgresql.org> | 2013-10-07 14:26:54 -0500 |
---|---|---|
committer | Kevin Grittner <kgrittn@postgresql.org> | 2013-10-07 14:26:54 -0500 |
commit | ef388b65a8b0aad40146ab9e45fe64b405396c7e (patch) | |
tree | b4b07db4bfe6f5d78334f40cf0156e92c1c00a14 /src/backend | |
parent | 9598134e3030a883ff6eea8a822466ce5143ffeb (diff) | |
download | postgresql-ef388b65a8b0aad40146ab9e45fe64b405396c7e.tar.gz postgresql-ef388b65a8b0aad40146ab9e45fe64b405396c7e.zip |
Eliminate xmin from hash tag for predicate locks on heap tuples.
If a tuple was frozen while its predicate locks mattered,
read-write dependencies could be missed, resulting in failure to
detect conflicts which could lead to anomalies in committed
serializable transactions.
This field was added to the tag when we still thought that it was
necessary to carry locks forward to a new version of an updated
row. That was later proven to be unnecessary, which allowed
simplification of the code, but elimination of xmin from the tag
was missed at the time.
Per report and analysis by Heikki Linnakangas.
Backpatch to 9.1.
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/storage/lmgr/predicate.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c index b012df1c5d9..63863ddf82c 100644 --- a/src/backend/storage/lmgr/predicate.c +++ b/src/backend/storage/lmgr/predicate.c @@ -156,9 +156,9 @@ * PredicateLockTuple(Relation relation, HeapTuple tuple, * Snapshot snapshot) * PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, - * BlockNumber newblkno); + * BlockNumber newblkno) * PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, - * BlockNumber newblkno); + * BlockNumber newblkno) * TransferPredicateLocksToHeapRelation(Relation relation) * ReleasePredicateLocks(bool isCommit) * @@ -381,7 +381,7 @@ static SHM_QUEUE *FinishedSerializableTransactions; * this entry, you can ensure that there's enough scratch space available for * inserting one entry in the hash table. This is an otherwise-invalid tag. */ -static const PREDICATELOCKTARGETTAG ScratchTargetTag = {0, 0, 0, 0, 0}; +static const PREDICATELOCKTARGETTAG ScratchTargetTag = {0, 0, 0, 0}; static uint32 ScratchTargetTagHash; static int ScratchPartitionLock; @@ -2492,8 +2492,6 @@ PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot) } } } - else - targetxmin = InvalidTransactionId; /* * Do quick-but-not-definitive test for a relation lock first. This will @@ -2512,8 +2510,7 @@ PredicateLockTuple(Relation relation, HeapTuple tuple, Snapshot snapshot) relation->rd_node.dbNode, relation->rd_id, ItemPointerGetBlockNumber(tid), - ItemPointerGetOffsetNumber(tid), - targetxmin); + ItemPointerGetOffsetNumber(tid)); PredicateLockAcquire(&tag); } @@ -4283,8 +4280,7 @@ CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, relation->rd_node.dbNode, relation->rd_id, ItemPointerGetBlockNumber(&(tuple->t_data->t_ctid)), - ItemPointerGetOffsetNumber(&(tuple->t_data->t_ctid)), - HeapTupleHeaderGetXmin(tuple->t_data)); + ItemPointerGetOffsetNumber(&(tuple->t_data->t_ctid))); CheckTargetForConflictsIn(&targettag); } |