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

Commit5734785

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 parentd3944c3 commit5734785

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
@@ -816,12 +816,6 @@ _bt_vacuum_needs_cleanup(IndexVacuumInfo *info)
816816
* If any oldest btpo.xact from a previously deleted page in the index
817817
* is older than RecentGlobalXmin, then at least one deleted page can
818818
* be recycled -- don't skip cleanup.
819-
*
820-
* Note that btvacuumpage currently doesn't make any effort to
821-
* recognize when a recycled page is already in the FSM (i.e. put
822-
* there by a previous VACUUM operation). We have to be conservative
823-
* because the FSM isn't crash safe. Hopefully recycled pages get
824-
* reused before too long.
825819
*/
826820
result= true;
827821
}
@@ -1064,15 +1058,6 @@ btvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
10641058

10651059
MemoryContextDelete(vstate.pagedelcontext);
10661060

1067-
/*
1068-
* Maintain a count of the oldest btpo.xact and current number of heap
1069-
* tuples in the metapage (for the benefit of _bt_vacuum_needs_cleanup).
1070-
* The oldest page is typically a page deleted by a previous VACUUM
1071-
* operation.
1072-
*/
1073-
_bt_update_meta_cleanup_info(rel,vstate.oldestBtpoXact,
1074-
info->num_heap_tuples);
1075-
10761061
/*
10771062
* If we found any recyclable pages (and recorded them in the FSM), then
10781063
* forcibly update the upper-level FSM pages to ensure that searchers can
@@ -1088,6 +1073,21 @@ btvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
10881073
if (vstate.totFreePages>0)
10891074
IndexFreeSpaceMapVacuum(rel);
10901075

1076+
/*
1077+
* Maintain the oldest btpo.xact and a count of the current number of heap
1078+
* tuples in the metapage (for the benefit of _bt_vacuum_needs_cleanup).
1079+
*
1080+
* The page with the oldest btpo.xact is typically a page deleted by this
1081+
* VACUUM operation, since pages deleted by a previous VACUUM operation
1082+
* tend to be placed in the FSM (by the current VACUUM operation) -- such
1083+
* pages are not candidates to be the oldest btpo.xact. (Note that pages
1084+
* placed in the FSM are reported as deleted pages in the bulk delete
1085+
* statistics, despite not counting as deleted pages for the purposes of
1086+
* determining the oldest btpo.xact.)
1087+
*/
1088+
_bt_update_meta_cleanup_info(rel,vstate.oldestBtpoXact,
1089+
info->num_heap_tuples);
1090+
10911091
/* update statistics */
10921092
stats->num_pages=num_pages;
10931093
stats->pages_free=vstate.totFreePages;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp