From 0d3aefb2749145044b99922fbf33730a0754cd50 Mon Sep 17 00:00:00 2001 From: Anastasia Lubennikova Date: Thu, 16 Feb 2023 16:24:47 +0200 Subject: [PATCH] Only use active timelines in synthetic_size calculation --- pageserver/src/tenant/size.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pageserver/src/tenant/size.rs b/pageserver/src/tenant/size.rs index 2c5efe283b..a41889f16d 100644 --- a/pageserver/src/tenant/size.rs +++ b/pageserver/src/tenant/size.rs @@ -134,7 +134,7 @@ pub(super) async fn gather_inputs( .context("Failed to refresh gc_info before gathering inputs")?; // Collect information about all the timelines - let timelines = tenant.list_timelines(); + let mut timelines = tenant.list_timelines(); if timelines.is_empty() { // perhaps the tenant has just been created, and as such doesn't have any data yet @@ -144,6 +144,13 @@ pub(super) async fn gather_inputs( }); } + // Filter out timelines that are not active + // + // There may be a race when a timeline is dropped, + // but it is unlikely to cause any issues. In the worst case, + // the calculation will error out. + timelines.retain(|t| t.is_active()); + // Build a map of branch points. let mut branchpoints: HashMap> = HashMap::new(); for timeline in timelines.iter() {