diff --git a/pageserver/src/page_cache.rs b/pageserver/src/page_cache.rs index e1e696ddad54..833b53894f56 100644 --- a/pageserver/src/page_cache.rs +++ b/pageserver/src/page_cache.rs @@ -425,27 +425,6 @@ impl PageCache { self.lock_for_read(&mut cache_key) } - /// Immediately drop all buffers belonging to given file - pub fn drop_buffers_for_immutable(&self, drop_file_id: FileId) { - for slot_idx in 0..self.slots.len() { - let slot = &self.slots[slot_idx]; - - let mut inner = slot.inner.write().unwrap(); - if let Some(key) = &inner.key { - match key { - CacheKey::ImmutableFilePage { file_id, blkno: _ } - if *file_id == drop_file_id => - { - // remove mapping for old buffer - self.remove_mapping(key); - inner.key = None; - } - _ => {} - } - } - } - } - // // Section 2: Internal interface functions for lookup/update. // diff --git a/pageserver/src/tenant/ephemeral_file.rs b/pageserver/src/tenant/ephemeral_file.rs index b149bc978809..ce8fd9ca3e66 100644 --- a/pageserver/src/tenant/ephemeral_file.rs +++ b/pageserver/src/tenant/ephemeral_file.rs @@ -221,9 +221,8 @@ pub fn is_ephemeral_file(filename: &str) -> bool { impl Drop for EphemeralFile { fn drop(&mut self) { - // drop all pages from page cache - let cache = page_cache::get(); - cache.drop_buffers_for_immutable(self.page_cache_file_id); + // There might still be pages in the [`crate::page_cache`] for this file. + // We leave them there, [`crate::page_cache::PageCache::find_victim`] will evict them when needed. // unlink the file let res = std::fs::remove_file(&self.file.path);