Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit81fbbfe

Browse files
committed
Fix bugs in SSI tuple locking.
1. In heap_hot_search_buffer(), the PredicateLockTuple() call is passedwrong offset number. heapTuple->t_self is set to the tid of the firsttuple in the chain that's visited, not the one actually being read.2. CheckForSerializableConflictIn() uses the tuple's t_ctid fieldinstead of t_self to check for exiting predicate locks on the tuple. Ifthe tuple was updated, but the updater rolled back, t_ctid points to theaborted dead tuple.Reported by Hannu Krosing. Backpatch to 9.1.
1 parent0b109c8 commit81fbbfe

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,8 @@ heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer,
16881688
at_chain_start=first_call;
16891689
skip= !first_call;
16901690

1691+
heapTuple->t_self=*tid;
1692+
16911693
/* Scan through possible multiple members of HOT-chain */
16921694
for (;;)
16931695
{
@@ -1717,7 +1719,7 @@ heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer,
17171719
heapTuple->t_data= (HeapTupleHeader)PageGetItem(dp,lp);
17181720
heapTuple->t_len=ItemIdGetLength(lp);
17191721
heapTuple->t_tableOid=RelationGetRelid(relation);
1720-
heapTuple->t_self=*tid;
1722+
ItemPointerSetOffsetNumber(&heapTuple->t_self,offnum);
17211723

17221724
/*
17231725
* Shouldn't see a HEAP_ONLY tuple at chain start.

‎src/backend/storage/lmgr/predicate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4279,8 +4279,8 @@ CheckForSerializableConflictIn(Relation relation, HeapTuple tuple,
42794279
SET_PREDICATELOCKTARGETTAG_TUPLE(targettag,
42804280
relation->rd_node.dbNode,
42814281
relation->rd_id,
4282-
ItemPointerGetBlockNumber(&(tuple->t_data->t_ctid)),
4283-
ItemPointerGetOffsetNumber(&(tuple->t_data->t_ctid)));
4282+
ItemPointerGetBlockNumber(&(tuple->t_self)),
4283+
ItemPointerGetOffsetNumber(&(tuple->t_self)));
42844284
CheckTargetForConflictsIn(&targettag);
42854285
}
42864286

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp