Skip to content

Commit

Permalink
Only remove not offloaded child registration in Timeline::drop
Browse files Browse the repository at this point in the history
  • Loading branch information
arpad-m committed Nov 14, 2024
1 parent 528749b commit 304bfef
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pageserver/src/tenant/timeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,17 @@ impl GcInfo {
self.retain_lsns.sort_by_key(|i| i.0);
}

pub(super) fn remove_child(&mut self, child_id: TimelineId) {
self.retain_lsns.retain(|i| i.1 != child_id);
pub(super) fn remove_child_maybe_offloaded(
&mut self,
child_id: TimelineId,
maybe_offloaded: MaybeOffloaded,
) {
self.retain_lsns
.retain(|i| !(i.1 == child_id && i.2 == maybe_offloaded));
}

pub(super) fn remove_child_not_offloaded(&mut self, child_id: TimelineId) {
self.remove_child_maybe_offloaded(child_id, MaybeOffloaded::No);
}
}

Expand Down Expand Up @@ -4501,7 +4510,7 @@ impl Drop for Timeline {
// This lock should never be poisoned, but in case it is we do a .map() instead of
// an unwrap(), to avoid panicking in a destructor and thereby aborting the process.
if let Ok(mut gc_info) = ancestor.gc_info.write() {
gc_info.remove_child(self.timeline_id)
gc_info.remove_child_not_offloaded(self.timeline_id)
}
}
}
Expand Down

0 comments on commit 304bfef

Please sign in to comment.