Compare commits

...

2 Commits

Author SHA1 Message Date
Alex Chi Z
496e96cdff Update pageserver/src/tenant.rs
Co-authored-by: Arpad Müller <arpad-m@users.noreply.github.com>
2024-05-21 13:32:57 -04:00
Alex Chi Z
63db18101e feat(pageserver): remove aux v1 keyspace if user fully switches to v2
Signed-off-by: Alex Chi Z <chi@neon.tech>
2024-05-21 11:21:27 -04:00
2 changed files with 11 additions and 3 deletions

View File

@@ -873,8 +873,12 @@ impl Timeline {
result.add_key(CONTROLFILE_KEY);
result.add_key(CHECKPOINT_KEY);
if self.get(AUX_FILES_KEY, lsn, ctx).await.is_ok() {
result.add_key(AUX_FILES_KEY);
// Remove v1 keyspace if the user has fully switched to v2.
if self.last_aux_file_policy.load() != Some(AuxFilePolicy::V2) {
if self.get(AUX_FILES_KEY, lsn, ctx).await.is_ok() {
result.add_key(AUX_FILES_KEY);
}
}
Ok((

View File

@@ -3970,7 +3970,7 @@ mod tests {
use crate::DEFAULT_PG_VERSION;
use bytes::{Bytes, BytesMut};
use hex_literal::hex;
use pageserver_api::key::{AUX_KEY_PREFIX, NON_INHERITED_RANGE};
use pageserver_api::key::{AUX_FILES_KEY, AUX_KEY_PREFIX, NON_INHERITED_RANGE};
use pageserver_api::keyspace::KeySpace;
use pageserver_api::models::CompactionAlgorithm;
use rand::{thread_rng, Rng};
@@ -5995,6 +5995,10 @@ mod tests {
files.get("pg_logical/mappings/test3"),
Some(&bytes::Bytes::from_static(b"last"))
);
// Check that we are going to remove v1 aux files.
let (mut dense_keyspace, _) = tline.collect_keyspace(lsn, &ctx).await.unwrap();
assert!(dense_keyspace.remove_overlapping_with(&KeySpace::single(AUX_FILES_KEY..AUX_FILES_KEY.next())).is_empty());
}
#[tokio::test]