-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[cache] Fix descriptor duplication in getAvailableBlobs #6092
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
base: master
Are you sure you want to change the base?
[cache] Fix descriptor duplication in getAvailableBlobs #6092
Conversation
92d0f5a
to
34ade39
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.
Please squash the commits.
The walkBlob function was called with a function having a side effect: appending a descriptor to a list. However, the function could be called multiple times for the same descriptor (once in `walkBlob` and once in `walkBlobVariantsOnly` in that case) leading to duplicate entries in the final list. Instead of the list, we can use a map to store the descriptors. With the digest as key, it will ensure we don't store duplicates. Signed-off-by: Baptiste Girard-Carrabin <[email protected]>
30b33bc
to
0858b9e
Compare
@ktock done, thanks for the review 🙇 |
@ktock any idea why the tests would be failing? I'm don't really understand the errors + it was not failing before I sqashed 🤔 |
TestGetRemotes failure doesn't look like caused by this change (posted a possible fix #6099). I'm rerunning the test.
|
Another failure but it also looks unrelated |
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.
If I look at the implementation of walkBlob
it is calling walkBlobVariantsOnly
with visited
map to avoid duplications. Isn't that one working correctly, and if it is not then probably should fix it there.
@tonistiigi it doesn't work as expected because:
I thought about fixing by moving the |
@tonistiigi do you mind giving me your updated opinion based on my message above? |
The walkBlob function was called with a function having a side effect: appending a descriptor to a list. However, the function could be called multiple times for the same descriptor (once in
walkBlob
and once inwalkBlobVariantsOnly
in that case) leading to duplicate entries in the final list. Instead of the list, we can use a map to store the descriptors. With the digest as key, it will ensure we don't store duplicates.This fixes one of the problem encountered in #6088
cc @ktock