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

Commit123474c

Browse files
nbtree: Minor sibling link traversal tweaks.
Tweak some code comments for clarity, and relocate some local variabledeclarations to the scope where they're actually used.Follow-up to recent commit1bd4bc8.
1 parentde5afdd commit123474c

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ _bt_readpage(IndexScanDesc scan, ScanDirection dir, OffsetNumber offnum,
15801580
so->currPos.currPage);
15811581
}
15821582

1583-
/* initialize remaining currPos fields (before moreLeft/moreright) */
1583+
/* initialize remaining currPos fields (before moreLeft/moreRight) */
15841584
so->currPos.lsn=BufferGetLSNAtomic(so->currPos.buf);
15851585
so->currPos.dir=dir;
15861586
so->currPos.nextTupleOffset=0;
@@ -2154,7 +2154,7 @@ _bt_readfirstpage(IndexScanDesc scan, OffsetNumber offnum, ScanDirection dir)
21542154
so->numKilled=0;/* just paranoia */
21552155
so->markItemIndex=-1;/* ditto */
21562156

2157-
/* Initialize currPos for so->currPos */
2157+
/* Initializeso->currPos forthe first page (page inso->currPos.buf) */
21582158
if (so->needPrimScan)
21592159
{
21602160
Assert(so->numArrayKeys);
@@ -2175,7 +2175,7 @@ _bt_readfirstpage(IndexScanDesc scan, OffsetNumber offnum, ScanDirection dir)
21752175
}
21762176

21772177
/*
2178-
* Attempt to load matching tuples from thepage in so->currPos.buf.
2178+
* Attempt to load matching tuples from thefirst page.
21792179
*
21802180
* Note that _bt_readpage will finish initializing the so->currPos fields.
21812181
* _bt_readpage also releases parallel scan (even when it returns false).
@@ -2208,8 +2208,7 @@ _bt_readfirstpage(IndexScanDesc scan, OffsetNumber offnum, ScanDirection dir)
22082208
* Caller's blkno is the next interesting page's link, taken from either the
22092209
* previously-saved right link or left link. lastcurrblkno is the page that
22102210
* was current at the point where the blkno link was saved, which we use to
2211-
* reason about concurrent page splits/page deletions during backwards scans
2212-
* (_bt_parallel_seize also requires it, regardless of scan direction).
2211+
* reason about concurrent page splits/page deletions during backwards scans.
22132212
*
22142213
* On entry, caller shouldn't hold any locks or pins on any page (we work
22152214
* directly off of blkno and lastcurrblkno instead). Parallel scan callers
@@ -2234,8 +2233,6 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno,
22342233
{
22352234
Relationrel=scan->indexRelation;
22362235
BTScanOpaqueso= (BTScanOpaque)scan->opaque;
2237-
Pagepage;
2238-
BTPageOpaqueopaque;
22392236

22402237
Assert(so->currPos.currPage==lastcurrblkno||scan->parallel_scan!=NULL);
22412238
Assert(!BTScanPosIsPinned(so->currPos));
@@ -2251,14 +2248,14 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno,
22512248

22522249
for (;;)
22532250
{
2254-
/*
2255-
* if we're at end of scan, give up and mark parallel scan as done, so
2256-
* that all the workers can finish their scan
2257-
*/
2251+
Pagepage;
2252+
BTPageOpaqueopaque;
2253+
22582254
if (blkno==P_NONE||
22592255
(ScanDirectionIsForward(dir) ?
22602256
!so->currPos.moreRight : !so->currPos.moreLeft))
22612257
{
2258+
/* most recent _bt_readpage call (for lastcurrblkno) ended scan */
22622259
_bt_parallel_done(scan);
22632260
BTScanPosInvalidate(so->currPos);
22642261
return false;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp