Skip to content

erofs: allow multiple cache directories - #13900

Merged
mxpv merged 1 commit into
containerd:mainfrom
mxpv:multi-cache
Aug 5, 2026
Merged

mxpv merged 1 commit into
containerd:mainfrom
mxpv:multi-cache

Conversation

@mxpv

@mxpv mxpv commented Aug 3, 2026

Copy link
Copy Markdown
Member

Follow up #13813

This PR allows specifying multiple cache directories like this:

[plugins."io.containerd.snapshotter.v1.erofs"]
  layer_content_caches = ["/back/os/cache", "/shared/nfs-cache"]

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.

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]>
Copilot AI review requested due to automatic review settings August 3, 2026 20:30
@github-project-automation github-project-automation Bot moved this to Needs Triage in Pull Request Review Aug 3, 2026
@mxpv mxpv mentioned this pull request Aug 3, 2026
7 tasks done

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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_cache config with layer_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-cache help 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.

Comment thread plugins/snapshots/erofs/erofs.go Resolved
@mxpv

mxpv commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

The change renames a user-facing config key

This is fine. 2.4 is not out yet.

@mxpv mxpv added this to the 2.4 milestone Aug 3, 2026
@mxpv mxpv moved this from Needs Triage to Needs Reviewers in Pull Request Review Aug 3, 2026
@github-project-automation github-project-automation Bot moved this from Needs Reviewers to Review In Progress in Pull Request Review Aug 5, 2026
@mxpv
mxpv added this pull request to the merge queue Aug 5, 2026
Merged via the queue into containerd:main with commit c9caf7e Aug 5, 2026
123 of 129 checks passed
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Pull Request Review Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants