Repository navigation
Support retries on conflicting image stream mapping create attempts - #5455
Conversation
5739cbd to
8e95bec
Compare
8e95bec to
d58e64f
Compare
|
@deads2k @smarterclayton @ncdc PTAL. |
|
[test] |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/6330/) |
|
Little bit of plumbing for that test, eh? lgtm |
😩 |
There was a problem hiding this comment.
If you have this then there is no point to having RetryOnConflic.t... which is supposed t handle conflict errors.
There was a problem hiding this comment.
Not sure I understand. If the error is not a conflict error, return early and pass that on to the client (i.e. no retry). If it is a conflict, do a deeper inspection to decide whether to allow the helper to deal with the conflict (i.e. retry).
|
Hold on LGTM |
|
Not using RetryOnConflict correctly. |
There was a problem hiding this comment.
All of this code should be at the beginning of the loop - guarded by "don't do this on the first loop".
Before the call to RetryOnConflict, set the last stream tag. At the beginning of the loop, check whether stream == nil. Then check whether old tag == new tag. If they don't, then exit. Do the mutation. If you get any error, clear stream (so the next iteration of the loop reads it again).
There was a problem hiding this comment.
If you want to terminate early, return a known error type that you convert to conflict on the outside.
There was a problem hiding this comment.
If you get any error, clear stream (so the next iteration of the loop reads it again).
This code relies on not resetting the stream unless it finds there isn't a real conflict. That logic ensures that it never re-attempts this work without an imagestream with a resourceversion that is known to be consistent with the first one we grabbed.
There was a problem hiding this comment.
Using a custom error type makes sense to clean up that little mess, but I'm still trying to understand what's being proposed for the rest of the refactor. I don't really see how what I have is wrong.
Add retry support to mapping creation to allow repeated update attempts when the conflicting resource doesn't contain any tag diffs.
d58e64f to
74190e7
Compare
I find the current code easier to inspect that the changes needed for |
|
I don't think the conflict-based aspect of the retry helper is buying us anything in this case since we have to micromanage the conflict error type ourselves (while the helper wants to assume that all conflicts mean "retry"). What would be more appropriate IMO is a generic retry/backoff helper that lets me return a bool indicating whether or not to retry (sort of like |
|
If you don't like RetryOnConflict, this isn't the time to change it, but if This code, as written, isn't really using RetryOnConflict the way its On Wed, Oct 28, 2015 at 2:38 PM, David Eads [email protected]
|
|
You can use wait.ExponentialBackoff and pass the same arguments, but you'll On Wed, Oct 28, 2015 at 2:44 PM, Clayton Coleman [email protected]
|
|
Refactored to use |
There was a problem hiding this comment.
Not sure that it matters- ExponentialBackoff will return due to err != nil. Technically we're also "done" at this point...
af13dc6 to
0ef34a0
Compare
|
I was recently faced with similar problem and tried to stay away from modifying the storage layer, but rather was inclined to that in the client code which should support situations as such. My reasoning was the storage should be as simple as possible, without any retry logic. Although code looks good, I'm not too happy with this change. I'm afraid it might hide some bigger problems... |
|
Retry for conflict on create is weird... we shouldn't make clients do that. Retry for conflict on update is fine for clients to have to handle, I think |
|
The root cause of this issue is we're trying to create ISM and update IS status at one shot, which ends up with those failures. Maybe in that case we should rather fix in |
|
Whereas most, if not all (except for this one and I think I know other one), of our storage are dealing with single object. Wherever more than one come into play, problems occur. |
|
This is an idempotent API operation (add mapping). So retry at the server is appropriate. |
|
OK, once this gets in, I'll revert one of the recent changes I did in https://github.com/openshift/origin/blob/master/pkg/dockerregistry/server/repositorymiddleware.go#L207-L212 as it'll be unnecessary. |
|
LGTM [merge] |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/6330/) (Image: devenv-rhel7_2587) |
|
Evaluated for origin merge up to 0ef34a0 |
|
Evaluated for origin test up to 0ef34a0 |
Merged by openshift-bot
Add retry support to mapping creation to allow repeated update attempts
when the conflicting resource doesn't contain any tag diffs.
Fixes #5421