#1346
fix: avoid writing memory-rejected disk hits back to storage
A disk-loaded entry rejected by the memory admission filter becomes a phantom entry. Under WriteOnEviction, dropping that phantom previously sent it through the storage pipe again, so a disk hit could run admission and enqueue another disk write.
Skip the pipe for phantom entries whose source is already disk. Ordinary outer-source phantoms and later evictions of memory-resident entries retain their existing writeback behavior.
The regression test verifies both that disk admission is not invoked a second time and that no keeper piece is enqueued. It fails against the previous behavior.
Validation:
cargo test -p foyer --lib --testscargo test -p foyer-memory --lib --tests- repository CI-equivalent Clippy configurations
Hi, Bill. Thank for contributing.
However, I think this PR is not right. Currently there are needs to write entries populated from disk back in some scenarios:
Disk cache performs a region-based eviction to reduce metadata updating cost. It may evicts both hot and cold entries in the meanwhile. When an entry becomes the 10% to evict entries but hit once, it will be reinserted into the disk cache to prevent the hot entry to be evicted later.
This PR will block the engine reinsertion.