Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit nbtree vacuum cycle id in nbtree xlog through forced FPIs #9932

Merged
merged 3 commits into from
Dec 10, 2024

Conversation

MMeent
Copy link
Contributor

@MMeent MMeent commented Nov 28, 2024

This fixes #9929.

Postgres repo PRS:

Problem

see #9929

Summary of changes

We update the split code to force the code to emit an FPI whenever the cycle ID might be interesting for concurrent btree vacuum.

Copy link

github-actions bot commented Nov 28, 2024

7073 tests run: 6758 passed, 0 failed, 315 skipped (full report)


Flaky tests (4)

Postgres 17

Postgres 15

Postgres 14

Code coverage* (full report)

  • functions: 31.4% (8334 of 26533 functions)
  • lines: 47.7% (65618 of 137548 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
6fc0edc at 2024-12-10T16:25:11.216Z :recycle:

@MMeent MMeent force-pushed the MMeent/fix/btree-split-cycleid branch 4 times, most recently from 27d46ea to b1e3d58 Compare November 29, 2024 16:17
@hlinnaka
Copy link
Contributor

hlinnaka commented Dec 2, 2024

A test case would be nice

@MMeent MMeent force-pushed the MMeent/fix/btree-split-cycleid branch 2 times, most recently from 69a1210 to 255c894 Compare December 6, 2024 23:09
NBTree needs a vacuum cycle ID on pages of whom the split resulted in a new
right page that is located before the original page, or who were split from
such split pages in the current vacuum cycle. By WAL-logging the cycle_id
and restoring it in recovery, we assure vacuum doesn't fail to clean up the
earlier pages.

During recovery, we extract the cycle ID from the original page if this page
had an FPI, either directly (when the page was restored) or indirectly (from
the record data).

This fixes #9929
@MMeent MMeent force-pushed the MMeent/fix/btree-split-cycleid branch from 255c894 to 1b29d9a Compare December 6, 2024 23:30
We need the cycle IDs, so make sure they're adequately logged, with a test case.
@MMeent MMeent force-pushed the MMeent/fix/btree-split-cycleid branch from 1b29d9a to c8ab1d1 Compare December 6, 2024 23:35
@MMeent
Copy link
Contributor Author

MMeent commented Dec 7, 2024

@hlinnaka I've added a test case that excercises the issue. It also discovered an issue in the PG patch, which I've fixed yesterday. I think this is now good to go.

NBTree needs a vacuum cycle ID on pages of whom the split resulted in a new
right page that is located before the original page, or who were split from
such split pages in the current vacuum cycle. By WAL-logging the cycle_id
and restoring it in recovery, we assure vacuum doesn't fail to clean up the
earlier pages.

During recovery, we extract the cycle ID from the original page if this page
had an FPI, either directly (when the page was restored) or indirectly (from
the record data).

This fixes #9929
@MMeent MMeent force-pushed the MMeent/fix/btree-split-cycleid branch from 332ecd9 to 6fc0edc Compare December 10, 2024 15:15
@MMeent MMeent enabled auto-merge December 10, 2024 15:15
@MMeent MMeent added the c/PostgreSQL Component: PostgreSQL features and bugs label Dec 10, 2024
@MMeent MMeent self-assigned this Dec 10, 2024
@MMeent MMeent added this pull request to the merge queue Dec 10, 2024
Merged via the queue into main with commit e71d20d Dec 10, 2024
85 of 89 checks passed
@MMeent MMeent deleted the MMeent/fix/btree-split-cycleid branch December 10, 2024 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/PostgreSQL Component: PostgreSQL features and bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Btree cycle ID isn't recorded in WAL causing incomplete nbtree vacuum of concurrent backward splits.
2 participants