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

Merged
merged 1 commit into from
Nov 22, 2024

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 .

@mtrmac mtrmac force-pushed the layer-compressed-metadata branch from b65f9aa to 3e936e1 Compare September 24, 2024 18:02
@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.)

@mtrmac mtrmac force-pushed the layer-compressed-metadata branch from 3e936e1 to 560ddea Compare October 2, 2024 13:13
@mtrmac mtrmac force-pushed the layer-compressed-metadata branch from 560ddea to a826a75 Compare October 16, 2024 19:54
@mtrmac mtrmac force-pushed the layer-compressed-metadata branch from a826a75 to 91d2dbc Compare October 23, 2024 22:15
@mtrmac mtrmac force-pushed the layer-compressed-metadata branch 2 times, most recently from 4e2e3ac to c35514f Compare October 25, 2024 21:06
@mtrmac mtrmac force-pushed the layer-compressed-metadata branch 2 times, most recently from bd375cc to ef22323 Compare November 20, 2024 20:29
…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]>
@mtrmac mtrmac force-pushed the layer-compressed-metadata branch from ef22323 to 8a9d3b9 Compare November 21, 2024 20:08
@mtrmac mtrmac merged commit cb1b224 into containers:main Nov 22, 2024
10 checks passed
@mtrmac mtrmac deleted the layer-compressed-metadata branch November 22, 2024 19:29
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