diff --git a/pageserver/src/http/routes.rs b/pageserver/src/http/routes.rs
index ef18129504..710014de98 100644
--- a/pageserver/src/http/routes.rs
+++ b/pageserver/src/http/routes.rs
@@ -75,7 +75,7 @@ fn get_config(request: &Request
) -> &'static PageServerConf {
// Helper functions to construct a LocalTimelineInfo struct for a timeline
fn local_timeline_info_from_loaded_timeline(
- timeline: &Timeline,
+ timeline: &Arc,
include_non_incremental_logical_size: bool,
include_non_incremental_physical_size: bool,
) -> anyhow::Result {
@@ -106,7 +106,11 @@ fn local_timeline_info_from_loaded_timeline(
prev_record_lsn: Some(timeline.get_prev_record_lsn()),
latest_gc_cutoff_lsn: *timeline.get_latest_gc_cutoff_lsn(),
timeline_state: LocalTimelineState::Loaded,
- current_logical_size: Some(timeline.get_current_logical_size()),
+ current_logical_size: Some(
+ timeline
+ .get_current_logical_size()
+ .context("Timeline info creation failed to get current logical size")?,
+ ),
current_physical_size: Some(timeline.get_physical_size()),
current_logical_size_non_incremental: if include_non_incremental_logical_size {
Some(timeline.get_current_logical_size_non_incremental(last_record_lsn)?)
@@ -212,7 +216,7 @@ async fn timeline_create_handler(mut request: Request) -> Result {
// Created. Construct a TimelineInfo for it.
- let local_info = local_timeline_info_from_loaded_timeline(new_timeline.as_ref(), false, false)?;
+ let local_info = local_timeline_info_from_loaded_timeline(&new_timeline, false, false)?;
Ok(Some(TimelineInfo {
tenant_id,
timeline_id: new_timeline_id,
diff --git a/pageserver/src/layered_repository.rs b/pageserver/src/layered_repository.rs
index 73c30b51b8..9d405b0033 100644
--- a/pageserver/src/layered_repository.rs
+++ b/pageserver/src/layered_repository.rs
@@ -136,14 +136,11 @@ impl Repository {
}
/// Get Timeline handle for locally available timeline. Load it into memory if it is not loaded.
- pub fn get_timeline_load(&self, timelineid: ZTimelineId) -> Result> {
+ pub fn get_timeline_load(&self, timeline_id: ZTimelineId) -> Result> {
let mut timelines = self.timelines.lock().unwrap();
- match self.get_timeline_load_internal(timelineid, &mut timelines)? {
+ match self.get_timeline_load_internal(timeline_id, &mut timelines)? {
Some(local_loaded_timeline) => Ok(local_loaded_timeline),
- None => anyhow::bail!(
- "cannot get local timeline: unknown timeline id: {}",
- timelineid
- ),
+ None => anyhow::bail!("cannot get local timeline, unknown timeline id: {timeline_id}"),
}
}
@@ -559,33 +556,34 @@ impl Repository {
timeline_id: ZTimelineId,
timelines: &mut HashMap,
) -> anyhow::Result