Repository navigation
core/unpack: fetch layers of every config-sharing manifest - #13966
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR fixes an unpack/fetch edge case where multiple manifests share the same config digest (e.g., compression variants), ensuring all manifests’ layer blobs are fetched into the content store, and adds regression tests for shared-config and “manifest without layers” scenarios.
Changes:
- Update
Unpacker.Unpackto accumulate multiple layer sets per config digest and fetch additional sets when a shared config is encountered. - Ignore manifests that reach the unpacker with no layers (config-only after filtering) to avoid false diffID mismatches.
- Add unit/integration tests covering shared-config manifests and config-only manifests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| core/unpack/unpacker.go | Accumulates multiple manifest layer sets per shared config and fetches all sets; skips config-only manifests. |
| core/unpack/unpacker_test.go | Adds regression tests for shared-config manifests and config-only manifests; introduces stub Snapshotter/Applier for fetch-only path. |
| core/unpack/pull_shared_config_test.go | Adds end-to-end pull pipeline test to ensure all shared-config manifest layers are fetched from a local registry. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
prakleumas
left a comment
There was a problem hiding this comment.
beep boop
Hello! I am @samuelkarp's friendly code review robot 🤖! Sam asked me to take a look and post my comments directly on GitHub.
Please treat my comments as suggestions and advisory, not mandates. Since I am an LLM and my output is used here directly, you should evaluate carefully and see if my suggestions make sense. Feel free to directly resolve any you disagree with.
This is not an automated action. This bot does not read or reply to comments.
943ed79 to
fb66444
Compare
samuelkarp
left a comment
There was a problem hiding this comment.
Can we update the PR description to clarify more about a "layer set" stored for a config? A config defines the layers by diffID (many per config) and we're talking about multiple separate manifests that reference the same config (and thus have identical unpacked layers), but I'm not sure exactly what we're discussing being stored there from that description alone. Are we storing all of the layers multiple times? Like, if manifest M1 defines layers L1, L2 and references config C1 (which has diffIDs for those layers), and then manifest M2 defines layers L1', L2' which are the same underlying layers (map to the same diffIDs) are we storing something like C1 -> [[L1, L2], [L1', L2']}?
fb66444 to
dd85530
Compare
dd85530 to
d604000
Compare
An index can carry more than one manifest that shares a config. A config lists uncompressed layer digests, so packaging the same layers with different compression (which `podman manifest push --add-compression` does) produces manifests with identical configs and the same config digest. Right now, when the unpacker visits a manifest, it stores its layers in a map keyed by its config's digest, so they can be unpacked later once the config descriptor is visited. Because that map holds only one manifest's layers per digest, when more than one manifest shares a config, only the last visited manifest's layers are stored (and unpacked), and the others' layers are never fetched. Image pulls still report success, but a later export or push of the image fails with NotFound. Fix this by changing the map to store the layers for all manifests pointing at a specific config (instead of just one manifest). This means manifests sharing the same config result in more than one set of layers being stored for the same config digest. Because manifests that share a config unpack to the same snapshot chain, we only need to unpack the first manifest's layers, and fetch the others (so their blobs reach the content store). Unpack skips fetching a layer whose snapshot already exists, so once a second manifest shares the config, the first manifest's layers are also fetched explicitly; a config named by a single manifest keeps that skip. Note that for indexes with more than one config-sharing manifest, this will now result in additional download time and storage for those layers. Don't store anything for a manifest with no layers; an empty slice reaching the unpack would fail the pull. Assisted-by: Claude Code Signed-off-by: Chris Henzie <[email protected]>
a37a5e6 to
3c5d9fe
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Concurrent unpack and fallback fetch operations can contend for the same content-store writer and fail the pull.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
|
Cherry-picking manually due to conflicts |
An index can carry more than one manifest that shares a config. A config lists uncompressed layer digests, so packaging the same layers with different compression (which
podman manifest push --add-compressiondoes) produces manifests with identical configs and the same config digest.Right now, when the unpacker visits a manifest, it stores its layers in a map keyed by its config's digest, so they can be unpacked later once the config descriptor is visited. Because that map holds only one manifest's layers per digest, when more than one manifest shares a config, only the last visited manifest's layers are stored (and unpacked), and the others' layers are never fetched. Image pulls still report success, but a later export or push of the image fails with NotFound.
Fix this by changing the map to store the layers for all manifests pointing at a specific config (instead of just one manifest). This means manifests sharing the same config result in more than one set of layers being stored for the same config digest. Because manifests that share a config unpack to the same snapshot chain, we only need to unpack the first manifest's layers, and fetch the others (so their blobs reach the content store). Unpack skips fetching a layer whose snapshot already exists, so once a second manifest shares the config, the first manifest's layers are also fetched explicitly; a config named by a single manifest keeps that skip. Note that for indexes with more than one config-sharing manifest, this will now result in additional download time and storage for those layers.
Don't store anything for a manifest with no layers; an empty slice reaching the unpack would fail the pull.
Fixes: #14000
Assisted-by: Claude Code