deletion queue: versions in keys

This commit is contained in:
John Spray
2023-08-16 17:49:20 +01:00
parent 10e927ee3e
commit 8eaa4015de
2 changed files with 23 additions and 10 deletions

View File

@@ -573,17 +573,33 @@ impl PageServerConf {
}
pub fn remote_deletion_list_path(&self, sequence: u64) -> RemotePath {
RemotePath::new(
&self
.remote_deletion_node_prefix()
.join(format!("{:016x}.list", sequence)),
)
// Encode a version in the key, so that if we ever switch away from JSON we can
// increment this.
const VERSION: u8 = 1;
// Placeholder, pending implementation of generation numbers
const GENERATION: u32 = 0;
RemotePath::new(&self.remote_deletion_node_prefix().join(format!(
"{sequence:016x}-{GENERATION:08x}-{VERSION:02x}.list"
)))
.expect("This should always be convertible, it is relative")
}
pub fn remote_deletion_header_path(&self) -> RemotePath {
RemotePath::new(&self.remote_deletion_node_prefix().join("header"))
.expect("This should always be convertible, it is relative")
// Encode a version in the key, so that if we ever switch away from JSON we can
// increment this.
const VERSION: u8 = 1;
// Placeholder, pending implementation of generation numbers
const GENERATION: u32 = 0;
RemotePath::new(
&self
.remote_deletion_node_prefix()
.join(format!("header-{GENERATION:08x}-{VERSION:02x}")),
)
.expect("This should always be convertible, it is relative")
}
pub fn tenant_path(&self, tenant_id: &TenantId) -> PathBuf {

View File

@@ -598,7 +598,6 @@ impl FrontendQueueWorker {
.await?;
debug!("Loaded {} keys in deletion prefix {}", lists.len(), prefix);
let list_name_pattern =
Regex::new("([a-zA-Z0-9]{16})-([a-zA-Z0-9]{8})-([a-zA-Z0-9]{2}).list").unwrap();
@@ -630,8 +629,6 @@ impl FrontendQueueWorker {
continue;
};
info!("seq_part {seq_part}");
let seq: u64 = match u64::from_str_radix(seq_part, 16) {
Ok(s) => s,
Err(e) => {