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

Commite370f10

Browse files
vacuumlazy.c: Standardize rel_pages terminology.
VACUUM's rel_pages field indicates the size of the target heap rel justafter the table_relation_vacuum() operation began. There are specificexpectations around how rel_pages can be related to other nearby state.In particular, the range of rel_pages must contain every tuple in therelation whose tuple headers might contain an XID < OldestXmin.Consistently refer to the field as rel_pages to make this clearer andmore discoverable.This is follow-up work to commit73f6ec3 from earlier today.Author: Peter Geoghegan <pg@bowt.ie>Reviewed-By: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/20220311031351.sbge5m2bpvy2ttxg@alap3.anarazel.de
1 parent73f6ec3 commite370f10

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ static void
825825
lazy_scan_heap(LVRelState*vacrel,intnworkers)
826826
{
827827
VacDeadItems*dead_items;
828-
BlockNumbernblocks=vacrel->rel_pages,
828+
BlockNumberrel_pages=vacrel->rel_pages,
829829
blkno,
830830
next_unskippable_block,
831831
next_failsafe_block,
@@ -858,7 +858,7 @@ lazy_scan_heap(LVRelState *vacrel, int nworkers)
858858

859859
/* Report that we're scanning the heap, advertising total # of blocks */
860860
initprog_val[0]=PROGRESS_VACUUM_PHASE_SCAN_HEAP;
861-
initprog_val[1]=nblocks;
861+
initprog_val[1]=rel_pages;
862862
initprog_val[2]=dead_items->max_items;
863863
pgstat_progress_update_multi_param(3,initprog_index,initprog_val);
864864

@@ -882,9 +882,9 @@ lazy_scan_heap(LVRelState *vacrel, int nworkers)
882882
* Before entering the main loop, establish the invariant that
883883
* next_unskippable_block is the next block number >= blkno that we can't
884884
* skip based on the visibility map, either all-visible for a regular scan
885-
* or all-frozen for an aggressive scan. We set it tonblocks if there's
886-
* no such block. We also set up the skipping_blocks flag correctly at
887-
* this stage.
885+
* or all-frozen for an aggressive scan. We set it torel_pages when
886+
*there'sno such block. We also set up the skipping_blocks flag
887+
*correctly atthis stage.
888888
*
889889
* Note: The value returned by visibilitymap_get_status could be slightly
890890
* out-of-date, since we make this test before reading the corresponding
@@ -902,7 +902,7 @@ lazy_scan_heap(LVRelState *vacrel, int nworkers)
902902
next_unskippable_block=0;
903903
if (vacrel->skipwithvm)
904904
{
905-
while (next_unskippable_block<nblocks)
905+
while (next_unskippable_block<rel_pages)
906906
{
907907
uint8vmstatus;
908908

@@ -929,7 +929,7 @@ lazy_scan_heap(LVRelState *vacrel, int nworkers)
929929
else
930930
skipping_blocks= false;
931931

932-
for (blkno=0;blkno<nblocks;blkno++)
932+
for (blkno=0;blkno<rel_pages;blkno++)
933933
{
934934
Bufferbuf;
935935
Pagepage;
@@ -947,7 +947,7 @@ lazy_scan_heap(LVRelState *vacrel, int nworkers)
947947
next_unskippable_block++;
948948
if (vacrel->skipwithvm)
949949
{
950-
while (next_unskippable_block<nblocks)
950+
while (next_unskippable_block<rel_pages)
951951
{
952952
uint8vmskipflags;
953953

@@ -992,15 +992,15 @@ lazy_scan_heap(LVRelState *vacrel, int nworkers)
992992
/*
993993
* The current page can be skipped if we've seen a long enough run
994994
* of skippable blocks to justify skipping it -- provided it's not
995-
* the last page in the relation (according to rel_pages/nblocks).
995+
* the last page in the relation (according to rel_pages).
996996
*
997997
* We always scan the table's last page to determine whether it
998998
* has tuples or not, even if it would otherwise be skipped. This
999999
* avoids having lazy_truncate_heap() take access-exclusive lock
10001000
* on the table to attempt a truncation that just fails
10011001
* immediately because there are tuples on the last page.
10021002
*/
1003-
if (skipping_blocks&&blkno<nblocks-1)
1003+
if (skipping_blocks&&blkno<rel_pages-1)
10041004
{
10051005
/*
10061006
* Tricky, tricky. If this is in aggressive vacuum, the page
@@ -1367,7 +1367,7 @@ lazy_scan_heap(LVRelState *vacrel, int nworkers)
13671367
vacrel->blkno=InvalidBlockNumber;
13681368

13691369
/* now we can compute the new value for pg_class.reltuples */
1370-
vacrel->new_live_tuples=vac_estimate_reltuples(vacrel->rel,nblocks,
1370+
vacrel->new_live_tuples=vac_estimate_reltuples(vacrel->rel,rel_pages,
13711371
vacrel->scanned_pages,
13721372
vacrel->live_tuples);
13731373

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp