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

Move the tar-split digest into the TOC #1902

Merged
merged 5 commits into from
May 16, 2024

Conversation

mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Apr 22, 2024

A minimal prototype for a fix of #1888 .

Note that this would immediately break pulling all currently-existing layers.

Also this probably increases memory requirements because the TOC exists as individual Go values longer.

Cc: @giuseppe

@@ -85,7 +86,7 @@ func GetType(t byte) (string, error) {
const (
ManifestChecksumKey = "io.github.containers.zstd-chunked.manifest-checksum"
ManifestInfoKey = "io.github.containers.zstd-chunked.manifest-position"
TarSplitChecksumKey = "io.github.containers.zstd-chunked.tarsplit-checksum"
TarSplitChecksumKey = "io.github.containers.zstd-chunked.tarsplit-checksum" // Deprecated: Use the TOC.TarSplitDigest field instead, this one is not authenticated by ManifestChecksumKey.
Copy link
Member

Choose a reason for hiding this comment

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

I think it is fine if we just break now, and not have to worry about it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The alternative would be to ignore the tar-split. That would make the current images consumable, but they would IIRC break on re-pushing the layers.

@rhatdan
Copy link
Member

rhatdan commented May 13, 2024

@giuseppe @mtrmac What should we do with this one?

@mtrmac
Copy link
Collaborator Author

mtrmac commented May 13, 2024

#1888 must have a solution. This is one possible solution; it also breaks all currently-existing zstd:chunked images, which might be fine or very bad, I don’t know which one it is.

@giuseppe
Copy link
Member

giuseppe commented May 14, 2024

#1888 must have a solution. This is one possible solution; it also breaks all currently-existing zstd:chunked images, which might be fine or very bad, I don’t know which one it is.

It is fine to break these images now.

The tarsplit data must not be mandatory. If the tarsplit data is missing, we should just skip fetching it (and deal with errors to recreate the original image later)

mtrmac added 4 commits May 14, 2024 10:53
This is a microptimization, we call strings.ToLower only
once, but more importantly it will make it easier to add
more fields.

Signed-off-by: Miloslav Trmač <[email protected]>
Other TOC formats don't fill the data in.

For now, this only increases memory usage, but we will
need the data soon.

Signed-off-by: Miloslav Trmač <[email protected]>
... so that we can uniquely identify partially-pulled layers
by the TOC digest.

Signed-off-by: Miloslav Trmač <[email protected]>
Include more details in the returned error text.

Don't continue in tests when we fail to obtain a TOC.

Signed-off-by: Miloslav Trmač <[email protected]>
@mtrmac mtrmac force-pushed the tar-split-digest branch from 791869f to 70b2454 Compare May 14, 2024 08:53
@mtrmac
Copy link
Collaborator Author

mtrmac commented May 14, 2024

With this PR:

  • If there is no tar-split offset, the image is accepted
  • If there is a tar-split offset and the new tar-split digest in the TOC, the image is accepted
  • If there is a tar-split offset and the TOC does not have the new digest, the image is rejected (most recently-created images are like this)

Alternatively, in the last case, we could accept the layer and ignore the tar-split data. If we do that, the images will continue to pull fine; but previously they also pushed fine and that would now break.

Marking ready for review now.

@mtrmac mtrmac marked this pull request as ready for review May 14, 2024 08:53
@giuseppe
Copy link
Member

  • If there is a tar-split offset and the TOC does not have the new digest, the image is rejected (most recently-created images are like this)

could we just drop it from the image generation and always ignore it? So we don't have to worry about it in future

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

code LGTM

@mtrmac
Copy link
Collaborator Author

mtrmac commented May 14, 2024

could we just drop it from the image generation and always ignore it? So we don't have to worry about it in future

I’m not sure which part you mean should be dropped. We need:

  • the offset to be provided somehow. Currently it is an annotation. (It could be in the TOC instead.)
  • a digest, in the TOC. (That’s being added in this PR. The previous digest, in the annotation, is still being added, but it is now ignored).

We can’t drop the tar-split offset. Do you mean to stop adding the TarSplitChecksumKey annotation? Something else?

@giuseppe
Copy link
Member

We can’t drop the tar-split offset. Do you mean to stop adding the TarSplitChecksumKey annotation? Something else?

yes, to stop doing that and use only the information in the TOC

We are already not reading it, so simplify the code.

Signed-off-by: Miloslav Trmač <[email protected]>
@mtrmac
Copy link
Collaborator Author

mtrmac commented May 14, 2024

Done.

@mtrmac mtrmac changed the title RFC: Move the tar-split digest into the TOC Move the tar-split digest into the TOC May 14, 2024
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

Thanks!

LGTM

Copy link
Contributor

openshift-ci bot commented May 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe, mtrmac

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rhatdan
Copy link
Member

rhatdan commented May 16, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label May 16, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit d55e41d into containers:main May 16, 2024
18 checks passed
@mtrmac mtrmac deleted the tar-split-digest branch May 17, 2024 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants