Only use active timelines in synthetic_size calculation

This commit is contained in:
Anastasia Lubennikova
2023-02-16 16:24:47 +02:00
parent 6139e8e426
commit 0d3aefb274

View File

@@ -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<TimelineId, HashSet<Lsn>> = HashMap::new();
for timeline in timelines.iter() {