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

Commit9037843

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 parent4dd5c31 commit9037843

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
@@ -1561,6 +1561,8 @@ heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer,
15611561
at_chain_start=first_call;
15621562
skip= !first_call;
15631563

1564+
heapTuple->t_self=*tid;
1565+
15641566
/* Scan through possible multiple members of HOT-chain */
15651567
for (;;)
15661568
{
@@ -1590,7 +1592,7 @@ heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer,
15901592
heapTuple->t_data= (HeapTupleHeader)PageGetItem(dp,lp);
15911593
heapTuple->t_len=ItemIdGetLength(lp);
15921594
heapTuple->t_tableOid=relation->rd_id;
1593-
heapTuple->t_self=*tid;
1595+
ItemPointerSetOffsetNumber(&heapTuple->t_self,offnum);
15941596

15951597
/*
15961598
* 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
@@ -4276,8 +4276,8 @@ CheckForSerializableConflictIn(Relation relation, HeapTuple tuple,
42764276
SET_PREDICATELOCKTARGETTAG_TUPLE(targettag,
42774277
relation->rd_node.dbNode,
42784278
relation->rd_id,
4279-
ItemPointerGetBlockNumber(&(tuple->t_data->t_ctid)),
4280-
ItemPointerGetOffsetNumber(&(tuple->t_data->t_ctid)));
4279+
ItemPointerGetBlockNumber(&(tuple->t_self)),
4280+
ItemPointerGetOffsetNumber(&(tuple->t_self)));
42814281
CheckTargetForConflictsIn(&targettag);
42824282
}
42834283

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp