-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
improve: use optimistic locking to avoid concurrency problem in admin… #2216
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tokers
force-pushed
the
improve/patch_with_cas
branch
2 times, most recently
from
September 11, 2020 09:13
cb19ca6
to
0ad096e
Compare
membphis
approved these changes
Sep 11, 2020
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.
nice PR
@membphis :) |
moonming
approved these changes
Sep 15, 2020
tokers
changed the title
improve: use optimistic locking to avoid concurrency problem in admin…
WIP: improve: use optimistic locking to avoid concurrency problem in admin…
Sep 16, 2020
@tokers got it, we can merge this PR later |
tokers
force-pushed
the
improve/patch_with_cas
branch
from
September 16, 2020 10:03
876b222
to
aeb050a
Compare
tokers
changed the title
WIP: improve: use optimistic locking to avoid concurrency problem in admin…
improve: use optimistic locking to avoid concurrency problem in admin…
Sep 16, 2020
@membphis Adjusted. |
tokers
force-pushed
the
improve/patch_with_cas
branch
from
September 17, 2020 06:51
aeb050a
to
c2e2e95
Compare
… PATCH APIs. There is a potential concurrency problem in all admin PATCH APIs when two patch requests come in simultaneously, in such case, the patched result of the first applied request will be overridden, also the probability is tidy, but from the perspective of software's robust, that's not what we wanna to see. In this commit, we use the optimistic locking to avoid this problem, for the example aforementioned, the second PATCH request will failure, and it's up to the user to retry this PATCH request again. The optimistic locking mechanism in ETCD v3 APIs is showed by it's transcation mechanism. Signed-off-by: tokers <zchao1995@gmail.com>
tokers
force-pushed
the
improve/patch_with_cas
branch
from
September 17, 2020 07:50
c2e2e95
to
3758498
Compare
@membphis Could you review this PR once again? The adjustment was done. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
There is a potential concurrency problem in all admin PATCH APIs when
two patch requests come in simultaneously, in such case, the patched
result of the first applied request will be overridden, although the
probability is tiny, from the perspective of software's robustness,
that's not what we wanna see.
In this commit, we use the optimistic locking to avoid this problem, for
the example aforementioned, the second PATCH request will failure, and
it's up to the user to retry this PATCH request again.
The optimistic locking mechanism in ETCD v2 APIs is showed by arg
prevIndex
.Signed-off-by: tokers zchao1995@gmail.com
Pre-submission checklist: