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

Commit69cf853

Browse files
Clear up issue with FSM and oldest bpto.xact.
On further reflection, code comments added by commitb0229f2 slightlymisrepresented how we determine the oldest bpto.xact for the index.btvacuumpage() does not treat the bpto.xact of a page that it put in theFSM as a candidate to be the oldest deleted page (the delete-marked pagethat has the oldest bpto.xact XID among all pages encountered).The definition of a deleted page for the purposes of the bpto.xactcalculation is different from the definition used by the bulk deletestatistics. The bulk delete statistics don't distinguish between pagesthat were deleted by the current VACUUM, pages deleted by a previousVACUUM operation but not yet recyclable/reusable, and pages that arereusable (though reusable pages are counted separately).Backpatch: 11-, just like commitb0229f2.
1 parent4e21f8b commit69cf853

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -824,12 +824,6 @@ _bt_vacuum_needs_cleanup(IndexVacuumInfo *info)
824824
* If any oldest btpo.xact from a previously deleted page in the index
825825
* is older than RecentGlobalXmin, then at least one deleted page can
826826
* be recycled -- don't skip cleanup.
827-
*
828-
* Note that btvacuumpage currently doesn't make any effort to
829-
* recognize when a recycled page is already in the FSM (i.e. put
830-
* there by a previous VACUUM operation). We have to be conservative
831-
* because the FSM isn't crash safe. Hopefully recycled pages get
832-
* reused before too long.
833827
*/
834828
result= true;
835829
}
@@ -1044,15 +1038,6 @@ btvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
10441038

10451039
MemoryContextDelete(vstate.pagedelcontext);
10461040

1047-
/*
1048-
* Maintain a count of the oldest btpo.xact and current number of heap
1049-
* tuples in the metapage (for the benefit of _bt_vacuum_needs_cleanup).
1050-
* The oldest page is typically a page deleted by a previous VACUUM
1051-
* operation.
1052-
*/
1053-
_bt_update_meta_cleanup_info(rel,vstate.oldestBtpoXact,
1054-
info->num_heap_tuples);
1055-
10561041
/*
10571042
* If we found any recyclable pages (and recorded them in the FSM), then
10581043
* forcibly update the upper-level FSM pages to ensure that searchers can
@@ -1068,6 +1053,21 @@ btvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
10681053
if (vstate.totFreePages>0)
10691054
IndexFreeSpaceMapVacuum(rel);
10701055

1056+
/*
1057+
* Maintain the oldest btpo.xact and a count of the current number of heap
1058+
* tuples in the metapage (for the benefit of _bt_vacuum_needs_cleanup).
1059+
*
1060+
* The page with the oldest btpo.xact is typically a page deleted by this
1061+
* VACUUM operation, since pages deleted by a previous VACUUM operation
1062+
* tend to be placed in the FSM (by the current VACUUM operation) -- such
1063+
* pages are not candidates to be the oldest btpo.xact. (Note that pages
1064+
* placed in the FSM are reported as deleted pages in the bulk delete
1065+
* statistics, despite not counting as deleted pages for the purposes of
1066+
* determining the oldest btpo.xact.)
1067+
*/
1068+
_bt_update_meta_cleanup_info(rel,vstate.oldestBtpoXact,
1069+
info->num_heap_tuples);
1070+
10711071
/* update statistics */
10721072
stats->num_pages=num_pages;
10731073
stats->pages_free=vstate.totFreePages;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp