refactors

This commit is contained in:
John Spray
2023-12-11 15:29:37 +00:00
parent 90e27f1800
commit 93e069ceae
2 changed files with 6 additions and 9 deletions
+5 -8
View File
@@ -480,14 +480,11 @@ impl Drop for LayerInner {
// We will only do I/O on drop if our Timeline still exists. Otherwise, we may safely
// leave garbage layers behind to be cleaned up the next time this Timeline is instantiated.
let timeline = match self.timeline.upgrade() {
Some(t) => t,
None => {
// no need to nag that timeline is gone: under normal situation on
// task_mgr::remove_tenant_from_memory the timeline is gone before we get dropped.
LAYER_IMPL_METRICS.inc_deletes_failed(DeleteFailed::TimelineGone);
return;
}
let Some(timeline) = self.timeline.upgrade() else {
// no need to nag that timeline is gone: under normal situation on
// task_mgr::remove_tenant_from_memory the timeline is gone before we get dropped.
LAYER_IMPL_METRICS.inc_deletes_failed(DeleteFailed::TimelineGone);
return;
};
// We will only do I/O during drop if our Timeline's layer_gate is open: this avoids
@@ -34,7 +34,7 @@ impl LayerManager {
}
pub(crate) fn clear(&mut self) {
std::mem::take(&mut self.layer_map);
self.layer_map = LayerMap::default();
self.layer_fmgr.clear();
}