#1374

fix(storage): reclaim when a flusher waits for a clean block

Opentonyalaribewants to merge intofrom

Start a reclaim when get_clean_block has to park a waiter, and once at the end of BlockManager::init. Previously reclaim ran only after taking a clean block or finishing a write or reclaim. A device recovered with 0 clean blocks therefore parked every flusher forever and never wrote again. on_reclaim_finish already hands the reclaimed block to a waiting flusher, and reclaim_if_needed still respects clean_block_threshold and reclaim concurrency.

Add test_store_write_after_recovery_without_clean_block. It overwrites every block file with a block that holds data, reopens the store, enqueues an entry, and bounds wait() with a 10 s timeout. This needs tokio's time feature in dev-dependencies.

Validation:

  • The new test fails with Elapsed without the fix and passes with it.
  • cargo test -p foyer-storage: 29 lib tests passed.
  • cargo fmt clean.

Fixes #1373.

Activity

3
MrCroxxapproved changes18d ago
MrCroxx18d ago

LGTM. Thank you, Anthony.

BTW, would you mind follow https://github.com/foyer-rs/foyer/issues/1373 to pass the DCO test. 🙏 Is not necessary, but recommended.

codecov[bot]18d ago

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests.

Files with missing linesCoverage Δ
foyer-storage/src/engine/block/engine.rs93.75% <100.00%> (+0.22%):arrow_up:
foyer-storage/src/engine/block/manager.rs98.20% <100.00%> (+0.01%):arrow_up:

... and 2 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.