-
Notifications
You must be signed in to change notification settings - Fork 40k
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 documentation of use of resourceVersion for update preconditions #2115
Comments
You're not setting the resource version during the PUT, that's why there's Brendan
|
I'm closing this as it is WAI. |
@brendanburns can you elaborate/point to documentation how to use the 'resourceVersion' property? Should the user increment +1 it everytime the PUT is sent? why isn't it incremented automatically by the server? or there are other rules to changing this property? |
@abonas Search for |
@bgrant0607 Thank you, read it. what's still not clear to me is "This value MUST be treated as opaque by clients and passed unmodified back to the server" - so when a user is passing a PUT request that updates the entity, the resourceVersion should not be changed? the next GET request after this PUT request will send to client an "increased by 1" resourceVersion value? |
You can't guarantee that it's increased by one, just that it will be The resourceVersion is used to enable optimistic concurrency for atomic The way that it works is like this: Client reads value, get's resource version N This write only succeeds if the current resource version matches N. This Client #1 Client #2 When these things happen in parallel, either the change to Foo.Bar or the Client #1 Client #2 One of the writes will now fail, since which ever write succeeds changes --brendan On Mon, Nov 3, 2014 at 7:21 AM, abonas notifications@github.com wrote:
|
@brendandburns thanks a lot. is there a predefined error code for cases when the write fails specifically due to a mismatch in resourceVersion as you describe above? so clients can distinguish this case from other types of failure during an update operation? |
Yeah, we send back HTTP 409 (conflict) in this case. See: On Mon, Nov 3, 2014 at 8:01 AM, abonas notifications@github.com wrote:
|
@brendandburns thanks! |
Are we sure about this is a WAI? I saw Travis failure with:
|
That's a bad test case - the server returned while the operation was continuing (because we exceeded the default async threshold). |
Hi, all, I'm not sure if it's the right place to ask question. While updating |
That works (200)
Then, PUT the exact same body to the created URL, and get a 409 Conflict.
Shouldn't you be able to update the same object with the same body as you created it with?
Maybe the problem is that there are some server-added fields that I should GET before PUTting back, but then why does this return 409 while you get a 422 for doing the same thing with /services?
The text was updated successfully, but these errors were encountered: