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

Commit6182e01

Browse files
committed
Don't clear btpo_cycleid during _bt_vacuum_one_page.
When "vacuuming" a single btree page by removing LP_DEAD tuples, we are notactually within a vacuum operation, but rather in an ordinary insertionprocess that could well be running concurrently with a vacuum. So clearingthe cycleid is incorrect, and could cause the concurrent vacuum to missremoving tuples that it needs to remove. This is a longstanding bugintroduced by commite628464 of2006-07-25. I believe it explains Maxim Boguk's recent report of indexcorruption, and probably some other previously unexplained reports.In 9.0 and up this is a one-line fix; before that we need to introduce aflag to tell _bt_delitems what to do.
1 parent3d2aa2c commit6182e01

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -829,11 +829,9 @@ _bt_delitems_delete(Relation rel, Buffer buf,
829829
PageIndexMultiDelete(page,itemnos,nitems);
830830

831831
/*
832-
*We canclear the vacuum cycle ID since this page has certainly been
833-
*processed by the current vacuum scan.
832+
*Unlike _bt_delitems_vacuum, we *must not*clear the vacuum cycle ID,
833+
*because this is not called by VACUUM.
834834
*/
835-
opaque= (BTPageOpaque)PageGetSpecialPointer(page);
836-
opaque->btpo_cycleid=0;
837835

838836
/*
839837
* Mark the page as not containing any LP_DEAD items. This is not
@@ -842,6 +840,7 @@ _bt_delitems_delete(Relation rel, Buffer buf,
842840
* true and it doesn't seem worth an additional page scan to check it.
843841
* Remember that BTP_HAS_GARBAGE is only a hint anyway.
844842
*/
843+
opaque= (BTPageOpaque)PageGetSpecialPointer(page);
845844
opaque->btpo_flags &= ~BTP_HAS_GARBAGE;
846845

847846
MarkBufferDirty(buf);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp