Repository navigation
erofs: allow multiple cache directories - #13900
Conversation
The layer content cache was a single directory, so every source of pre-converted blobs had to be merged into one tree. A shared read-only fleet cache, a host-local cache, and a per-image warm cache could not coexist. Replace layer_content_cache with layer_content_caches, a list. Each directory is checked in order and the first hit is staged into the snapshot; a layer found in none of them falls back to the normal download-and-convert path. Cache directories are no longer required to exist at startup. A missing one is indistinguishable from an empty one at lookup time (both are simply a miss), and it may well be mounted after the daemon starts, so the only check left is that each path is absolute -- a relative one would be symlinked into the snapshot dir and dangle. Signed-off-by: Maksym Pavlenko <[email protected]>
There was a problem hiding this comment.
🟡 Not ready to approve
The change renames a user-facing config key and removes a previously exported Go option function without backward-compatibility shims, which can break existing deployments and external consumers.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR extends the EROFS snapshotter’s “warm layer cache” feature to support a configurable search path of multiple cache directories, and changes cache behavior so missing directories are treated as cache misses rather than startup errors.
Changes:
- Replace the single
layer_content_cacheconfig withlayer_content_caches(ordered list), and validate configured cache dirs as absolute paths. - Update cache lookup to search directories in order, skipping unreadable caches and treating missing caches/blobs as misses.
- Extend Linux tests to cover multi-directory behavior and absolute-path validation; update
ctr images build-erofs-cachehelp text accordingly.
File summaries
| File | Description |
|---|---|
| plugins/snapshots/erofs/plugin/plugin.go | Exposes layer_content_caches in plugin config and wires it into snapshotter options. |
| plugins/snapshots/erofs/erofs.go | Implements multi-directory cache config + lookup logic and startup validation changes. |
| plugins/snapshots/erofs/erofs_linux_test.go | Updates existing cache tests and adds coverage for multi-cache search order and absolute-path requirement. |
| cmd/ctr/commands/images/build_erofs_cache.go | Updates CLI help text to refer to the new plural config key. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
This is fine. 2.4 is not out yet. |
Follow up #13813
This PR allows specifying multiple cache directories like this:
This makes it possible to layer caches with different owners and lifetimes. For example, a cache baked directly into the OS image can serve the DaemonSet containers that ship with every node, while a second, optionally mounted cache serves workload containers. Cache directories are no longer required to exist at startup: a missing one is treated as a cache miss.