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

Commit846cfe0

Browse files
Fix obsolete _bt_first comments.
_bt_first doesn't necessarily hold onto a buffer pin on success exit.Fix header comments that claimed that we'll always hold onto a pin.Oversight in commit2ed5b87.
1 parent0d82970 commit846cfe0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎src/backend/access/nbtree/nbtsearch.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -862,14 +862,15 @@ _bt_compare(Relation rel,
862862
*We need to be clever about the direction of scan, the search
863863
*conditions, and the tree ordering. We find the first item (or,
864864
*if backwards scan, the last item) in the tree that satisfies the
865-
*qualifications in the scan key. On success exit, the page containing
866-
*the current index tuple is pinned but not locked, and data about
867-
*the matching tuple(s) on the page has been loaded into so->currPos.
865+
*qualifications in the scan key. On success exit, data about the
866+
*matching tuple(s) on the page has been loaded into so->currPos. We'll
867+
*drop all locks and hold onto a pin on page's buffer, except when
868+
*_bt_drop_lock_and_maybe_pin dropped the pin to avoid blocking VACUUM.
868869
*scan->xs_heaptid is set to the heap TID of the current tuple, and if
869870
*requested, scan->xs_itup points to a copy of the index tuple.
870871
*
871872
* If there are no matching items in the index, we return false, with no
872-
* pins or locks held.
873+
* pins or locks held. so->currPos will remain invalid.
873874
*
874875
* Note that scan->keyData[], and the so->keyData[] scankey built from it,
875876
* are both search-type scankeys (see nbtree/README for more about this).
@@ -1470,6 +1471,8 @@ _bt_next(IndexScanDesc scan, ScanDirection dir)
14701471
BTScanOpaqueso= (BTScanOpaque)scan->opaque;
14711472
BTScanPosItem*currItem;
14721473

1474+
Assert(BTScanPosIsValid(so->currPos));
1475+
14731476
/*
14741477
* Advance to next tuple on current page; or if there's no more, try to
14751478
* step to the next page with data.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp