Skip to content

fix(overlaybd): preserve premerged-index cache during full-file cache recovery - #170

Open
huajq wants to merge 1 commit into
kvcache-ai:mainfrom
huajq:fix/overlaybd-cache-preserve-premerged-index
Open

fix(overlaybd): preserve premerged-index cache during full-file cache recovery#170
huajq wants to merge 1 commit into
kvcache-ai:mainfrom
huajq:fix/overlaybd-cache-preserve-premerged-index

Conversation

@huajq

@huajq huajq commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

What

Skip the reserved premerged-index subdirectory when full-file cache recovery
scans cacheDir, plus a regression test.

Why

The LSMT premerged-index artifact cache lives inside the scanned cacheDir.
Every ImageService creation (node restart, uvm-ublk-daemon lazy creation /
respawn) logged load cache from disk failed err=cache meta not exists and
deleted the whole directory, wiping the cache and racing in-flight writes
(rename ... No such file or directory).

Related issue

N/A — small fix from production logs.

Scope and non-goals

Included: recovery skip + test. Excluded: any on-disk layout change;
writer-side retry (no longer needed).

Design and behavior changes

Recovery skips PREMERGED_INDEX_DIR (re-exported crate-wide as the single
source of truth). Real cache entries are still discarded on load failure.

Compatibility and operations

No API, config, layout, or host requirement changes. Existing .pmidx
artifacts now persist across restarts. Safe to roll back.

Validation

cargo fmt --all -- --check                             # pass
cargo clippy -p overlaybd --all-targets -- -D warnings # pass
cargo test -p overlaybd --lib                          # 310 passed, 0 failed

Skipped: make wrappers and unrelated suites; only overlaybd is touched.

Risks and reviewer notes

Main file: storage/overlaybd/src/backend/cache/full_file_cache/cache_pool.rs.
Only effect is that the directory named premerged-index survives recovery.

Checklist

  • The PR contains one coherent change and no unrelated formatting or refactoring.
  • New behavior is covered by tests, or I explained why testing is impractical.
  • Logs and examples contain no credentials, tokens, or private registry information.
  • I did not manually edit generated code without updating its source and regenerating it.

… recovery

BackendState::load_from_disk scans every subdirectory of cacheDir and
treats each as a full-file cache entry. The LSMT premerged-index
artifact cache lives in the same cache root, so every ImageService
creation logged "load cache from disk failed err=cache meta not
exists" and deleted the whole premerged-index directory, wiping the
artifacts and racing in-flight artifact writes (rename ENOENT).

Skip the reserved premerged-index directory during recovery so the
artifact cache survives process restarts and lazy ImageService
creations.
@huajq
huajq requested a review from LSX-s-Software August 14, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant