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

s3: bugfix, use sync.Map instead of map for storing multi part upload… #436

Merged
merged 1 commit into from
Mar 3, 2022

Conversation

peusebiu
Copy link
Collaborator

@peusebiu peusebiu commented Mar 2, 2022

…s references

add storage lock in GetIndexContent

Signed-off-by: Petu Eusebiu peusebiu@cisco.com

What type of PR is this?

Which issue does this PR fix:

What does this PR do / Why do we need it:

If an issue # is not available please add repro steps and logs from IPAMD/CNI showing the issue:

Testing done on this change:

Automation added to e2e:

Will this break upgrades or downgrades. Has updating a running cluster been tested?:

Does this change require updates to the CNI daemonset config files to work?:

Does this PR introduce any user-facing change?:


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@peusebiu peusebiu requested a review from rchincha March 2, 2022 18:42
@peusebiu peusebiu requested a review from andaaron March 2, 2022 18:43
@peusebiu peusebiu added the bug Something isn't working label Mar 2, 2022
@codecov
Copy link

codecov bot commented Mar 2, 2022

Codecov Report

Merging #436 (a2b338b) into main (bf21435) will increase coverage by 0.02%.
The diff coverage is 98.03%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #436      +/-   ##
==========================================
+ Coverage   83.71%   83.74%   +0.02%     
==========================================
  Files          49       49              
  Lines       10158    10174      +16     
==========================================
+ Hits         8504     8520      +16     
  Misses       1294     1294              
  Partials      360      360              
Impacted Files Coverage Δ
pkg/storage/s3/storage.go 85.43% <97.82%> (+0.17%) ⬆️
pkg/storage/storage_fs.go 78.83% <100.00%> (+0.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf21435...a2b338b. Read the comment docs.

@peusebiu peusebiu added this to In progress in zot-core via automation Mar 2, 2022
@@ -35,6 +35,24 @@ const (
RWLOCK = "RWLock"
)

type multiPartUploads struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you need this struct at all? Couldn't you have just used a sync.Map directly? It is nice to have the apis, but still.

@@ -45,8 +63,8 @@ type ObjectStorage struct {
// We must keep track of multi part uploads to s3, because the lib
// which we are using doesn't cancel multiparts uploads
// see: https://github.com/distribution/distribution/blob/main/registry/storage/driver/s3-aws/s3.go#L545
isMultiPartUpload map[string]bool
metrics monitoring.MetricServer
multiPartUploads multiPartUploads
Copy link
Contributor

Choose a reason for hiding this comment

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

This could just be a sync.Map

…s references

add storage lock in GetIndexContent

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
Copy link
Contributor

@rchincha rchincha left a comment

Choose a reason for hiding this comment

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

lgtm

zot-core automation moved this from In progress to Reviewer approved Mar 3, 2022
@rchincha rchincha merged commit 9cffbca into project-zot:main Mar 3, 2022
zot-core automation moved this from Reviewer approved to Done Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
zot-core
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants