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

feat(pageserver): persist reldir v2 migration status #10980

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

skyzh
Copy link
Member

@skyzh skyzh commented Feb 25, 2025

Problem

part of #9516

Summary of changes

Similar to the aux v2 migration, we persist the relv2 migration status into index_part, so that even the config item is set to false, we will still read from the v2 storage to avoid loss of data.

Note that only the two variants None and Some(RelSizeMigration::Migrating) are used for now. We don't have full migration implemented so it will never be set to RelSizeMigration::Migrated.

Signed-off-by: Alex Chi Z <chi@neon.tech>
@skyzh skyzh requested a review from erikgrinaker February 25, 2025 20:39
@skyzh skyzh requested a review from a team as a code owner February 25, 2025 20:39
Copy link

github-actions bot commented Feb 25, 2025

705 tests run: 659 passed, 0 failed, 46 skipped (full report)


Flaky tests (1)

Postgres 17

Test coverage report is not available

The comment gets automatically updated with the latest test results
3044fb6 at 2025-02-25T23:39:17.096Z :recycle:

Comment on lines +2896 to +2897
self.rel_size_v2_status
.store(Some(Arc::new(rel_size_v2_status.clone())));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update this after the index upload is scheduled, since it can fail.

Also, nit: this is a bare enum, so we can derive Copy and avoid the cloning.

@@ -2380,6 +2385,13 @@ impl Timeline {
.unwrap_or(self.conf.default_tenant_conf.rel_size_v2_enabled)
}

pub(crate) fn get_rel_size_v2_status(&self) -> Option<RelSizeMigration> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would it be easier to just unwrap this to Legacy instead of propagating the None?

@@ -1719,6 +1722,34 @@ impl DatadirModification<'_> {
Ok(())
}

/// Returns `true` if the rel_size_v2 write path is enabled. If it is the first time that
/// we enable it, we also need to persist it in `index_part.json`.
pub fn do_enable_rel_size_v2(&mut self) -> anyhow::Result<bool> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: consider maybe_enable_rel_size_v2 since it is conditional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants