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

Commit07eef53

Browse files
Use scanned_pages to decide when to failsafe check.
Perform a failsafe check every time VACUUM's first heap scan scans afurther FAILSAFE_EVERY_PAGES pages, rather than using an approach basedon the number of physical blocks that our current blkno is from theblkno at the time of the previous failsafe check. That way VACUUM willperform a failsafe check every time it has scanned a uniform number ofpages, without it mattering when or how VACUUM skipped pages using thevisibility map.Sami Imseih, with changes to FAILSAFE_EVERY_PAGES comments added by me.Author: Sami Imseih <simseih@amazon.com>Reviewed-By: Peter Geoghegan <pg@bowt.ie>Discussion:https://postgr.es/m/401CE010-4049-4B94-9961-0B610A5D254D%40amazon.com
1 parent4ce3afb commit07eef53

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@
9494
#defineBYPASS_THRESHOLD_PAGES0.02/* i.e. 2% of rel_pages */
9595

9696
/*
97-
* Perform a failsafe check every 4GB during the heap scan, approximately
97+
* Perform a failsafe check each time we scan another 4GB of pages.
98+
* (Note that this is deliberately kept to a power-of-two, usually 2^19.)
9899
*/
99100
#defineFAILSAFE_EVERY_PAGES \
100101
((BlockNumber) (((uint64) 4 * 1024 * 1024 * 1024) / BLCKSZ))
@@ -821,7 +822,6 @@ lazy_scan_heap(LVRelState *vacrel)
821822
BlockNumberrel_pages=vacrel->rel_pages,
822823
blkno,
823824
next_unskippable_block,
824-
next_failsafe_block=0,
825825
next_fsm_block_to_vacuum=0;
826826
VacDeadItems*dead_items=vacrel->dead_items;
827827
Buffervmbuffer=InvalidBuffer;
@@ -895,11 +895,8 @@ lazy_scan_heap(LVRelState *vacrel)
895895
* one-pass strategy, and the two-pass strategy with the index_cleanup
896896
* param set to 'off'.
897897
*/
898-
if (blkno-next_failsafe_block >=FAILSAFE_EVERY_PAGES)
899-
{
898+
if (vacrel->scanned_pages %FAILSAFE_EVERY_PAGES==0)
900899
lazy_check_wraparound_failsafe(vacrel);
901-
next_failsafe_block=blkno;
902-
}
903900

904901
/*
905902
* Consider if we definitely have enough space to process TIDs on page

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp