-
Notifications
You must be signed in to change notification settings - Fork 385
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
blob: TryReusingBlobWithOptions
consider RequiredCompression
if set
#2023
Conversation
I tested the docker blob's in combination with a variant of code from #1987 and it is working as expected. I made similar changes to other transport as well where change was applicable. |
65b7f41
to
bb04be5
Compare
@mtrmac PTAL |
e9089cc
to
1bf8943
Compare
On second thought, I’m afraid that doesn’t work well. For converting from gzip to zstd, we ideally want an operation to express “I have a gzip blob, but I want zstd; so check if there is a zstd variant, but don’t use a gzip one even if it is an exact match”. In that case So every single transport needs to deal with this, sadly, and your original approach was correct. The Note that the |
1bf8943
to
d3d5df7
Compare
@mtrmac PTAL |
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.
I’m sorry, for some reason 3 comments were left pending.
d3d5df7
to
7304098
Compare
1779182
to
77b9752
Compare
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.
blobCacheDestination.TryReusingBlobWithOptions
also needs to implement this- AFAICS the docker transport can crash
- blob:
TryReusingBlobWithOptions
considerRequiredCompression
if set #2023 (comment) : I’d prefer not to add the new semantics of carrying the original blob’s algorithm inBlobInfo
; one more field inTryReusingBlobOptions
seems more explicit to me
docker/docker_image_dest.go
Outdated
continue | ||
} | ||
if !impl.BlobMatchesRequiredCompression(options, compressionAlgorithm) { | ||
logrus.Debugf("Ignoring candidate blob %s as reuse candidate since compression %s was requested and blob has compression %s", candidate.Digest.String(), options.RequiredCompression.Name(), compressionAlgorithm.Name()) |
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.
This also needs to not crash on compressionAlgorithm == nil
.
(Also compare the “Trying to reuse” code; including candidateRepo.Name()
seems useful — especially if the code is moved so that the “trying” logs aren’t emitted at all.)
(Absolutely non-blocking: making this a bit shorter would help on narrow terminals / log viewers: “Not using …, compression mismatch (%s vs. %s)”. The text should make sense but it can probably be assumed the reader can refer to the related source code, so it doesn’t need to be quite self-documenting.)
77b9752
to
cdd22f1
Compare
@mtrmac Could you PTAL again. |
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.
Thanks, one last cleanup round please.
3938c90
to
c637ac7
Compare
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.
Also one outstanding item from #2023 (review):
blobCacheDestination.TryReusingBlobWithOptions
also needs to implement this
3d230ea
to
4f8c039
Compare
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.
Thanks!
Fixes: containers#2023 (comment). `assert.Equal` expects `assert.Equal(t, expected, actual)` instead of `assert.Equal(t, actual, expected)`. Ref:https://pkg.go.dev/github.com/stretchr/testify/assert#Assertions.Equal Signed-off-by: Aditya R <[email protected]>
Modifies `copy/single` to correctly use the feature from containers#2023, that is if compression is changed blob must be resued only if it matches required compression. Signed-off-by: Aditya R <[email protected]>
Modifies `copy/single` to correctly use the feature from containers#2023, that is if compression is changed blob must be resued only if it matches required compression. Signed-off-by: Aditya R <[email protected]>
Modifies `copy/single` to correctly use the feature from containers#2023, that is if compression is changed blob must be resued only if it matches required compression. Signed-off-by: Aditya R <[email protected]>
Modifies `copy/single` to correctly use the feature from containers#2023, that is if compression is changed blob must be resued only if it matches required compression. Signed-off-by: Aditya R <[email protected]>
Modifies `copy/single` to correctly use the feature from containers#2023, that is if compression is changed blob must be resued only if it matches required compression. Signed-off-by: Aditya R <[email protected]>
Modifies `copy/single` to correctly use the feature from containers#2023, that is if compression is changed blob must be resued only if it matches required compression. Signed-off-by: Aditya R <[email protected]>
ForceCompressionFormat allows end users to force selected compression format (set in DestinationCtx.CompressionFormat) which ensures that while copying blobs of other compression algorithms are not reused. Following flag is a frontend wrapper for: containers#2023 Will help in: * containers/buildah#4613 * containers/podman#18660 Signed-off-by: Aditya R <[email protected]>
ForceCompressionFormat allows end users to force selected compression format (set in DestinationCtx.CompressionFormat) which ensures that while copying blobs of other compression algorithms are not reused. Following flag is a frontend wrapper for: containers#2023 Will help in: * containers/buildah#4613 * containers/podman#18660 Signed-off-by: Aditya R <[email protected]>
ForceCompressionFormat allows end users to force selected compression format (set in DestinationCtx.CompressionFormat) which ensures that while copying blobs of other compression algorithms are not reused. Following flag is a frontend wrapper for: containers#2023 Will help in: * containers/buildah#4613 * containers/podman#18660 Signed-off-by: Aditya R <[email protected]>
ForceCompressionFormat allows end users to force selected compression format (set in DestinationCtx.CompressionFormat) which ensures that while copying blobs of other compression algorithms are not reused. Following flag is a frontend wrapper for: containers#2023 Will help in: * containers/buildah#4613 * containers/podman#18660 Signed-off-by: Aditya R <[email protected]>
ForceCompressionFormat allows end users to force selected compression format (set in DestinationCtx.CompressionFormat) which ensures that while copying blobs of other compression algorithms are not reused. Following flag is a frontend wrapper for: containers#2023 Will help in: * containers/buildah#4613 * containers/podman#18660 Signed-off-by: Aditya R <[email protected]>
ForceCompressionFormat allows end users to force selected compression format (set in DestinationCtx.CompressionFormat) which ensures that while copying blobs of other compression algorithms are not reused. Following flag is a frontend wrapper for: containers#2023 Will help in: * containers/buildah#4613 * containers/podman#18660 Signed-off-by: Aditya R <[email protected]>
ForceCompressionFormat allows end users to force selected compression format (set in DestinationCtx.CompressionFormat) which ensures that while copying blobs of other compression algorithms are not reused. Following flag is a frontend wrapper for: containers#2023 Will help in: * containers/buildah#4613 * containers/podman#18660 Signed-off-by: Aditya R <[email protected]>
ForceCompressionFormat allows end users to force selected compression format (set in DestinationCtx.CompressionFormat) which ensures that while copying blobs of other compression algorithms are not reused. Following flag is a frontend wrapper for: containers#2023 Will help in: * containers/buildah#4613 * containers/podman#18660 Signed-off-by: Aditya R <[email protected]>
Fixes: containers#2023 (comment). `assert.Equal` expects `assert.Equal(t, expected, actual)` instead of `assert.Equal(t, actual, expected)`. Ref:https://pkg.go.dev/github.com/stretchr/testify/assert#Assertions.Equal Signed-off-by: Aditya R <[email protected]>
Modifies `copy/single` to correctly use the feature from containers#2023, that is if compression is changed blob must be resued only if it matches required compression. Signed-off-by: Aditya R <[email protected]>
Fixes: containers#2023 (comment). `assert.Equal` expects `assert.Equal(t, expected, actual)` instead of `assert.Equal(t, actual, expected)`. Ref:https://pkg.go.dev/github.com/stretchr/testify/assert#Assertions.Equal Signed-off-by: Aditya R <[email protected]>
Modifies `copy/single` to correctly use the feature from containers#2023, that is if compression is changed blob must be resued only if it matches required compression. Signed-off-by: Aditya R <[email protected]>
Fixes: containers#2023 (comment). `assert.Equal` expects `assert.Equal(t, expected, actual)` instead of `assert.Equal(t, actual, expected)`. Ref:https://pkg.go.dev/github.com/stretchr/testify/assert#Assertions.Equal Signed-off-by: Aditya R <[email protected]>
Modifies `copy/single` to correctly use the feature from containers#2023, that is if compression is changed blob must be resued only if it matches required compression. Signed-off-by: Aditya R <[email protected]>
TryReusingBlob now contains a new option
RequiredCompression
which filters the blob by checking against a compression of the blob which is considerd to be resued, in caseRequiredCompression
is set andinfo
of the blob being reused does not matches, no blob is returned.