-
Notifications
You must be signed in to change notification settings - Fork 242
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
race, storage: add independent AddNames
and RemoveNames
for images,layers and containers
#1153
Conversation
65795e9
to
e89ae7c
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.
Would a {Add,Delete}Name
API address the races?
46e6c7d
to
4a853d4
Compare
@vrothberg Bunch of code in There are some other things as well where we might have race but maybe that is part of a different PR. |
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.
code changes LGTM
Wouldn't that be more difficult to handle for the caller? If it is adding multiple names and the operation fails middle way, should it then try to delete previously added ones? |
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 we need atomic name additions, we certainly also need atomic name removals. So I’d expect something like UpdateNames(id string, updates NameUpdates)
with type NameUpdates struct { addNames, removeNames []string }
There was also an issue I can’t quickly find about store.CreateImage
doing name updates and other changes atomically with other operations, that’s why I suggest a type NameUpdates
that could be reused in that other feature.
What difference does that make? Every line calling |
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, if we know the old APIs are racy, they should be documented as deprecated. |
Yes, |
|
4a853d4
to
e54dfbf
Compare
If we have a consensus on new API then i guess its cool. We can create a new API. |
e54dfbf
to
4abecdc
Compare
SetNameWithOptions
to make destructive nature of SetName
optionalAddNames
and RemoveNames
for images,layers and containers
4abecdc
to
1441d33
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.
Not at all a thorough review
Invoking parallel/concurrent builds from podman race against each other following behviour was fixed in containers/storage#1153 and containers/image#1480 Test verifies if following bug is fixed in new race-free API or not. Read more about this issue, see bz 2055487 for more details. Test manually backported from: containers@63f92d0 Signed-off-by: Aditya R <arajan@redhat.com>
Invoking parallel/concurrent builds from podman race against each other following behviour was fixed in containers/storage#1153 and containers/image#1480 Test verifies if following bug is fixed in new race-free API or not. Read more about this issue, see bz 2055487 for more details. Test manually backported from: containers/podman@63f92d0 Signed-off-by: Aditya R <arajan@redhat.com>
Invoking parallel/concurrent builds from podman race against each other following behviour was fixed in containers/storage#1153 and containers/image#1480 Test verifies if following bug is fixed in new race-free API or not. Read more about this issue, see bz 2055487 for more details. More details here: containers/buildah#3794 and containers#13339 Co-authored-by: Ed Santiago <santiago@redhat.com> Signed-off-by: Aditya R <arajan@redhat.com>
PR containers/storage#1153 added a dedicated API to remove names assigned image so use `RemoveNames` instead of racy `SetNames`. How to verify ```console printf 'from quay.io/jitesoft/alpine:latest\nrun for i in $(seq 0 10000); do touch /$i; done\n' >Containerfile && for i in `seq 1 25`; do ./buildah build --squash --iidfile id.$i --timestamp 0 . & done; wait; ls -al ``` * Refer to newly added integration test. Closes: containers/podman#15162 Signed-off-by: Aditya R <arajan@redhat.com>
PR containers/storage#1153 added a dedicated API to remove names assigned image so use `RemoveNames` instead of racy `SetNames`. How to verify ```console printf 'from quay.io/jitesoft/alpine:latest\nrun for i in $(seq 0 10000); do touch /$i; done\n' >Containerfile && for i in `seq 1 25`; do ./buildah build --squash --iidfile id.$i --timestamp 0 . & done; wait; ls -al ``` * Refer to newly added integration test. Closes: containers/podman#15162 Signed-off-by: Aditya R <arajan@redhat.com>
PR containers/storage#1153 added a dedicated API to remove names assigned image so use `RemoveNames` instead of racy `SetNames`. How to verify ```console printf 'from quay.io/jitesoft/alpine:latest\nrun for i in $(seq 0 10000); do touch /$i; done\n' >Containerfile && for i in `seq 1 25`; do ./buildah build --squash --iidfile id.$i --timestamp 0 . & done; wait; ls -al ``` * Refer to newly added integration test. Closes: containers/podman#15162 Signed-off-by: Aditya R <arajan@redhat.com>
PR containers/storage#1153 added a dedicated API to remove names assigned image so use `RemoveNames` instead of racy `SetNames`. How to verify ```console printf 'from quay.io/jitesoft/alpine:latest\nrun for i in $(seq 0 10000); do touch /$i; done\n' >Containerfile && for i in `seq 1 25`; do ./buildah build --squash --iidfile id.$i --timestamp 0 . & done; wait; ls -al ``` * Refer to newly added integration test. Closes: containers/podman#15162 Signed-off-by: Aditya R <arajan@redhat.com>
PR containers/storage#1153 added a dedicated API to remove names assigned image so use `RemoveNames` instead of racy `SetNames`. How to verify ```console printf 'from quay.io/jitesoft/alpine:latest\nrun for i in $(seq 0 10000); do touch /$i; done\n' >Containerfile && for i in `seq 1 25`; do ./buildah build --squash --iidfile id.$i --timestamp 0 . & done; wait; ls -al ``` * Refer to newly added integration test. Closes: containers/podman#15162 Signed-off-by: Aditya R <arajan@redhat.com>
PR containers/storage#1153 added a dedicated API to remove names assigned image so use `RemoveNames` instead of racy `SetNames`. How to verify ```console printf 'from quay.io/jitesoft/alpine:latest\nrun for i in $(seq 0 10000); do touch /$i; done\n' >Containerfile && for i in `seq 1 25`; do ./buildah build --squash --iidfile id.$i --timestamp 0 . & done; wait; ls -al ``` * Refer to newly added integration test. Closes: containers/podman#15162 Signed-off-by: Aditya R <arajan@redhat.com>
PR containers/storage#1153 added a dedicated API to remove names assigned image so use `RemoveNames` instead of racy `SetNames`. How to verify ```console printf 'from quay.io/jitesoft/alpine:latest\nrun for i in $(seq 0 10000); do touch /$i; done\n' >Containerfile && for i in `seq 1 25`; do ./buildah build --squash --iidfile id.$i --timestamp 0 . & done; wait; ls -al ``` * Refer to newly added integration test. Closes: containers/podman#15162 Signed-off-by: Aditya R <arajan@redhat.com>
PR containers/storage#1153 added a dedicated API to remove names assigned image so use `RemoveNames` instead of racy `SetNames`. How to verify ```console printf 'from quay.io/jitesoft/alpine:latest\nrun for i in $(seq 0 10000); do touch /$i; done\n' >Containerfile && for i in `seq 1 25`; do ./buildah build --squash --iidfile id.$i --timestamp 0 . & done; wait; ls -al ``` * Refer to newly added integration test. Closes: containers/podman#15162 Signed-off-by: Aditya R <arajan@redhat.com>
PR containers/storage#1153 added a dedicated API to remove names assigned image so use `RemoveNames` instead of racy `SetNames`. How to verify ```console printf 'from quay.io/jitesoft/alpine:latest\nrun for i in $(seq 0 10000); do touch /$i; done\n' >Containerfile && for i in `seq 1 25`; do ./buildah build --squash --iidfile id.$i --timestamp 0 . & done; wait; ls -al ``` * Refer to newly added integration test. Closes: containers/podman#15162 Signed-off-by: Aditya R <arajan@redhat.com>
PR containers/storage#1153 added a dedicated API to remove names assigned image so use `RemoveNames` instead of racy `SetNames`. How to verify ```console printf 'from quay.io/jitesoft/alpine:latest\nrun for i in $(seq 0 10000); do touch /$i; done\n' >Containerfile && for i in `seq 1 25`; do ./buildah build --squash --iidfile id.$i --timestamp 0 . & done; wait; ls -al ``` * Refer to newly added integration test. Closes: containers/podman#15162 Signed-off-by: Aditya R <arajan@redhat.com>
Adds
SetNameWithOptions
so operations which are invoke in parallelmanner can use it without destroying names from storage.
For instance
We are deleting names which were already written in store.
This creates faulty behavior when builds are invoked in parallel manner, as
this removes names for other builds.
To fix this behavior we must append to already written names and
override if needed. But this should be optional and not break public API
Following patch will be used by parallel operations at podman or buildah end, directly or indirectly.
PR replaces: #1152