Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate CompressedDigest/CompressedSize when reusing data from another layer #2583

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Sep 24, 2024

We record (some) CompressedDigest/CompressedSize when pulling a layer from registry; but, previously, we would lose these values (and record uncompressed values) when creating a duplicate of a layer already present in storage. Eventually, the original layer might get deleted and then we would only find a match in BlobInfoCache, under more restrictive conditions.

Instead, try to propagate the value to the duplicated layer. This might not work if the layer has multiple compressed representations, but that's hopefully not all that frequent.

This activates the other half of containers/storage#1830 .

@cgwalters
Copy link
Contributor

when creating a duplicate of a layer already present in storage.

For my own edification it'd be awesome if you can elaborate on why we do this somewhere

@mtrmac
Copy link
Collaborator Author

mtrmac commented Sep 24, 2024

The c/storage data model is designed to work on not just overlay, but snapshot systems. (In the worst case, device-mapper snapshots, although that backend was recently completely removed. Relevant today: the VFS driver creates layers by first copying all files from the parent into the child.) In that model, a layer can only be applied on top of its “original” parent, it can’t be assembled on top of some other parent.

(That conceptual model is also demonstrated by the API shape, where Layer.Parent is a single layer ID, and immutable. Layers form a tree; it’s not a general DAG, neither are they not a pool to arbitrarily assemble images from.)

…her layer

We record (some) CompressedDigest/CompressedSize when pulling a layer from
registry; but, previously, we would lose these values (and record uncompressed values)
when creating a duplicate of a layer already present in storage. Eventually,
the original layer might get deleted and then we would only find a match
in BlobInfoCache, under more restrictive conditions.

Instead, try to propagate the value to the duplicated layer. This might
not work if the layer has multiple compressed representations, but
that's hopefully not all _that_ frequent.

Signed-off-by: Miloslav Trmač <[email protected]>
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.

3 participants