Skip to content

Commit

Permalink
Rename IndexPart::{from_s3_bytes,to_s3_bytes} (#9481)
Browse files Browse the repository at this point in the history
We support multiple storage backends now, so remove the `_s3_` from the
name.

Analogous to the names adopted for tenant manifests added in #9444.
  • Loading branch information
arpad-m authored Oct 22, 2024
1 parent 64949a3 commit 3a3bd34
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pageserver/ctl/src/index_part.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
24 changes: 12 additions & 12 deletions pageserver/src/tenant/remote_timeline_client/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ impl IndexPart {
self.disk_consistent_lsn
}

pub fn from_s3_bytes(bytes: &[u8]) -> Result<Self, serde_json::Error> {
pub fn from_json_bytes(bytes: &[u8]) -> Result<Self, serde_json::Error> {
serde_json::from_slice::<IndexPart>(bytes)
}

pub fn to_s3_bytes(&self) -> serde_json::Result<Vec<u8>> {
pub fn to_json_bytes(&self) -> serde_json::Result<Vec<u8>> {
serde_json::to_vec(self)
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion pageserver/src/tenant/remote_timeline_client/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

1 comment on commit 3a3bd34

@github-actions
Copy link

Choose a reason for hiding this comment

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

5326 tests run: 5101 passed, 1 failed, 224 skipped (full report)


Failures on Postgres 16

  • test_storage_controller_many_tenants[github-actions-selfhosted]: release-x86-64
# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_storage_controller_many_tenants[release-pg16-github-actions-selfhosted]"
Flaky tests (2)

Postgres 17

Code coverage* (full report)

  • functions: 31.4% (7663 of 24430 functions)
  • lines: 48.8% (60256 of 123375 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
3a3bd34 at 2024-10-23T00:00:48.134Z :recycle:

Please sign in to comment.