diff --git a/pageserver/src/tenant/storage_layer.rs b/pageserver/src/tenant/storage_layer.rs index 81f9e8ec13..54aceb6a34 100644 --- a/pageserver/src/tenant/storage_layer.rs +++ b/pageserver/src/tenant/storage_layer.rs @@ -984,6 +984,11 @@ impl LayerE { kind: tokio::sync::OnceCell::default(), }); + self.access_stats.record_residence_event( + LayerResidenceStatus::Resident, + LayerResidenceEventReason::ResidenceChange, + ); + Ok(if self.wanted_evicted.load(Ordering::Acquire) { // because we reset wanted_evictness earlier, this most likely means when we were downloading someone // wanted to evict this layer. @@ -1156,6 +1161,8 @@ impl LayerE { let res = capture_mtime_and_delete.await; + this.access_stats.record_residence_event(LayerResidenceStatus::Evicted, LayerResidenceEventReason::ResidenceChange); + drop(this.status.send(Status::Evicted)); match res {