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

Commitcc736ed

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 parent4750eae commitcc736ed

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
@@ -1673,6 +1673,8 @@ heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer,
16731673
at_chain_start=first_call;
16741674
skip= !first_call;
16751675

1676+
heapTuple->t_self=*tid;
1677+
16761678
/* Scan through possible multiple members of HOT-chain */
16771679
for (;;)
16781680
{
@@ -1702,7 +1704,7 @@ heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer,
17021704
heapTuple->t_data= (HeapTupleHeader)PageGetItem(dp,lp);
17031705
heapTuple->t_len=ItemIdGetLength(lp);
17041706
heapTuple->t_tableOid=relation->rd_id;
1705-
heapTuple->t_self=*tid;
1707+
ItemPointerSetOffsetNumber(&heapTuple->t_self,offnum);
17061708

17071709
/*
17081710
* 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