mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-17 10:22:56 +00:00
feat(pageserver): remove aux v1 keyspace if user fully switches to v2
Signed-off-by: Alex Chi Z <chi@neon.tech>
This commit is contained in:
@@ -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((
|
||||
|
||||
@@ -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 if 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]
|
||||
|
||||
Reference in New Issue
Block a user