diff --git a/pageserver/ctl/src/index_part.rs b/pageserver/ctl/src/index_part.rs index 20018846f8fa..6cce2844c74a 100644 --- a/pageserver/ctl/src/index_part.rs +++ b/pageserver/ctl/src/index_part.rs @@ -11,7 +11,7 @@ pub(crate) async fn main(cmd: &IndexPartCmd) -> anyhow::Result<()> { match cmd { IndexPartCmd::Dump { path } => { let bytes = tokio::fs::read(path).await.context("read file")?; - let des: IndexPart = IndexPart::from_s3_bytes(&bytes).context("deserialize")?; + let des: IndexPart = IndexPart::from_json_bytes(&bytes).context("deserialize")?; let output = serde_json::to_string_pretty(&des).context("serialize output")?; println!("{output}"); Ok(()) diff --git a/pageserver/src/tenant/remote_timeline_client/index.rs b/pageserver/src/tenant/remote_timeline_client/index.rs index 3a74a4ed1186..d8a881a2c443 100644 --- a/pageserver/src/tenant/remote_timeline_client/index.rs +++ b/pageserver/src/tenant/remote_timeline_client/index.rs @@ -121,11 +121,11 @@ impl IndexPart { self.disk_consistent_lsn } - pub fn from_s3_bytes(bytes: &[u8]) -> Result { + pub fn from_json_bytes(bytes: &[u8]) -> Result { serde_json::from_slice::(bytes) } - pub fn to_s3_bytes(&self) -> serde_json::Result> { + pub fn to_json_bytes(&self) -> serde_json::Result> { serde_json::to_vec(self) } @@ -383,7 +383,7 @@ mod tests { last_aux_file_policy: None, }; - let part = IndexPart::from_s3_bytes(example.as_bytes()).unwrap(); + let part = IndexPart::from_json_bytes(example.as_bytes()).unwrap(); assert_eq!(part, expected); } @@ -427,7 +427,7 @@ mod tests { last_aux_file_policy: None, }; - let part = IndexPart::from_s3_bytes(example.as_bytes()).unwrap(); + let part = IndexPart::from_json_bytes(example.as_bytes()).unwrap(); assert_eq!(part, expected); } @@ -472,7 +472,7 @@ mod tests { last_aux_file_policy: None, }; - let part = IndexPart::from_s3_bytes(example.as_bytes()).unwrap(); + let part = IndexPart::from_json_bytes(example.as_bytes()).unwrap(); assert_eq!(part, expected); } @@ -520,7 +520,7 @@ mod tests { last_aux_file_policy: None, }; - let empty_layers_parsed = IndexPart::from_s3_bytes(empty_layers_json.as_bytes()).unwrap(); + let empty_layers_parsed = IndexPart::from_json_bytes(empty_layers_json.as_bytes()).unwrap(); assert_eq!(empty_layers_parsed, expected); } @@ -563,7 +563,7 @@ mod tests { last_aux_file_policy: None, }; - let part = IndexPart::from_s3_bytes(example.as_bytes()).unwrap(); + let part = IndexPart::from_json_bytes(example.as_bytes()).unwrap(); assert_eq!(part, expected); } @@ -609,7 +609,7 @@ mod tests { last_aux_file_policy: None, }; - let part = IndexPart::from_s3_bytes(example.as_bytes()).unwrap(); + let part = IndexPart::from_json_bytes(example.as_bytes()).unwrap(); assert_eq!(part, expected); } @@ -660,7 +660,7 @@ mod tests { last_aux_file_policy: Some(AuxFilePolicy::V2), }; - let part = IndexPart::from_s3_bytes(example.as_bytes()).unwrap(); + let part = IndexPart::from_json_bytes(example.as_bytes()).unwrap(); assert_eq!(part, expected); } @@ -716,7 +716,7 @@ mod tests { last_aux_file_policy: Default::default(), }; - let part = IndexPart::from_s3_bytes(example.as_bytes()).unwrap(); + let part = IndexPart::from_json_bytes(example.as_bytes()).unwrap(); assert_eq!(part, expected); } @@ -773,7 +773,7 @@ mod tests { last_aux_file_policy: Default::default(), }; - let part = IndexPart::from_s3_bytes(example.as_bytes()).unwrap(); + let part = IndexPart::from_json_bytes(example.as_bytes()).unwrap(); assert_eq!(part, expected); } @@ -835,7 +835,7 @@ mod tests { archived_at: None, }; - let part = IndexPart::from_s3_bytes(example.as_bytes()).unwrap(); + let part = IndexPart::from_json_bytes(example.as_bytes()).unwrap(); assert_eq!(part, expected); } diff --git a/pageserver/src/tenant/remote_timeline_client/upload.rs b/pageserver/src/tenant/remote_timeline_client/upload.rs index 5a2b7bd08fad..0cd5d05aa276 100644 --- a/pageserver/src/tenant/remote_timeline_client/upload.rs +++ b/pageserver/src/tenant/remote_timeline_client/upload.rs @@ -41,7 +41,7 @@ pub(crate) async fn upload_index_part<'a>( pausable_failpoint!("before-upload-index-pausable"); // FIXME: this error comes too late - let serialized = index_part.to_s3_bytes()?; + let serialized = index_part.to_json_bytes()?; let serialized = Bytes::from(serialized); let index_part_size = serialized.len();