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

Commite8d74ad

Browse files
committed
Report syncscan position at end of scan.
The comment in heapgettup_advance_block() says that it reports thescan position before checking for end of scan, but that didn't matchthe code. The code was refactored in commit7ae0ab0, whichinadvertently changed the order of the check and reporting. Change itback.This caused a few regression test failures with a small shared_bufferssetting like 10 MB. The 'portals' and 'cluster' tests perform seqscansthat are large enough that sync seqscans kick in. When the sync scanposition is not updated at end of scan, the next seq scan doesn'tstart at the beginning of the table, and the test queries aresensitive to that.Reviewed-by: Melanie Plageman, David RowleyDiscussion:https://www.postgresql.org/message-id/6f991389-ae22-d844-a9d8-9aceb7c01a9a@iki.fiBackpatch-through: 16
1 parentd7ceb41 commite8d74ad

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -647,17 +647,6 @@ heapgettup_advance_block(HeapScanDesc scan, BlockNumber block, ScanDirection dir
647647
if (block >=scan->rs_nblocks)
648648
block=0;
649649

650-
/* we're done if we're back at where we started */
651-
if (block==scan->rs_startblock)
652-
returnInvalidBlockNumber;
653-
654-
/* check if the limit imposed by heap_setscanlimits() is met */
655-
if (scan->rs_numblocks!=InvalidBlockNumber)
656-
{
657-
if (--scan->rs_numblocks==0)
658-
returnInvalidBlockNumber;
659-
}
660-
661650
/*
662651
* Report our new scan position for synchronization purposes. We
663652
* don't do that when moving backwards, however. That would just
@@ -673,6 +662,17 @@ heapgettup_advance_block(HeapScanDesc scan, BlockNumber block, ScanDirection dir
673662
if (scan->rs_base.rs_flags&SO_ALLOW_SYNC)
674663
ss_report_location(scan->rs_base.rs_rd,block);
675664

665+
/* we're done if we're back at where we started */
666+
if (block==scan->rs_startblock)
667+
returnInvalidBlockNumber;
668+
669+
/* check if the limit imposed by heap_setscanlimits() is met */
670+
if (scan->rs_numblocks!=InvalidBlockNumber)
671+
{
672+
if (--scan->rs_numblocks==0)
673+
returnInvalidBlockNumber;
674+
}
675+
676676
returnblock;
677677
}
678678
else

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp