-
Notifications
You must be signed in to change notification settings - Fork 379
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
Add FIXMEs about handling of zstd:chunked blob annotations on blob changes #1894
Conversation
2b4eb97
to
891630a
Compare
@giuseppe FYI, to make sure you have the full picture. If this handling is unreasonable, please speak up. |
if @giuseppe is hip with these changes, LGTM |
in the case of zstd:chunked, they apply to the binary representation. |
Ah, right; that sentence was describing the difficulty for the general We will probably, longer-term, end up with a list of per-concept / per-representation annotations… |
891630a
to
a4b6785
Compare
Signed-off-by: Miloslav Trmač <[email protected]>
…anges It's completely undefined whether the OCI blob annotations apply to the object as a concept, regardless of representation, or to the specific binary representation. So it's unclear whether we should preserve or drop them when compressing/decompressing/substituting blobs. In particular, we currently don't truly correctly handle the zstd:chunked annotations on: - decompression (should be dropped) - recompression (should be dropped) - substitution (should be replaced by data about the other blob, if any; we don't record that) Right now, we drop all annotations on decompression and recompression (which happens to work fine), and preserve annotations on substitution (which is technically invalid). Luckily, the zstd:chunked use is opportunistic, and if the annotations are invalid or not applicable, the manifest checksum fails, and we fall through to an ordinary pull; so, that is not quite a deal breaker. So, for now, just add FIXMEs recording the pain points. To fix this truly correctly, we would need: - a new metadataCleaner field in pkg/compression/internal.Algorithm - a new pkg/compression.CleanMetadata - turning public manifest.Manifest into internal/manifest.Manifest where we can add methods - adding internal/manifest.Manifest.LayerInfosWithCompression that turns MIME types into compression.Algorithm values - (using that in copy.copyLayer instead of the current hard-coded switch) - then either defining a new alternative to UpdatedImage that can handle these annotations naturally, or all the marked users that need to clean the annotations themselves calling LayerInfosWithCompression and CleanMetadata on the affected blobs. - recording the zstd annotations in the blob info cache - reading those annotations when substituting blobs based on the cache We should do all that long-term, but that's quite a lot of work to fix a metadata inconsistency which we can currently silently, with moderate cost, hide from the user. Signed-off-by: Miloslav Trmač <[email protected]>
@giuseppe waiting on you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It's completely undefined whether the OCI blob annotations apply to the object as a concept, regardless of representation, or to the specific binary representation. So it's unclear whether we should preserve or drop them when compressing/decompressing/substituting blobs.
In particular, we currently don't truly correctly handle the zstd:chunked annotations on:
Right now, we drop all annotations on decompression and recompression (which happens to work fine), and preserve annotations on substitution (which is technically invalid).
Luckily, the zstd:chunked use is opportunistic, and if the annotations are invalid or not applicable, the manifest checksum fails, and we fall through to an ordinary pull; so, that is not quite a deal breaker.
So, for now, just add FIXMEs recording the pain points.
To fix this truly correctly, we would need:
metadataCleaner
field inpkg/compression/internal.Algorithm
pkg/compression.CleanMetadata
manifest.Manifest
intointernal/manifest.Manifest
where we can add methodsinternal/manifest.Manifest.LayerInfosWithCompression
that turns MIME types into `compression.Algorigthm valuescopy.copyLayer
instead of the current hard-coded switch)UpdatedImage
that can handle these annotations naturally,or all the marked users that need to clean the annotations themselves calling
LayerInfosWithCompression
and
CleanMetadata
on the affected blobs.We should do all that long-term, but that's quite a lot of work to fix a metadata inconsistency which we can currently silently, with moderate cost, hide from the user.
Also includes a fix for some typos discovered when scoping the “correct” fix.