-
Notifications
You must be signed in to change notification settings - Fork 15
Example for avoiding conflicts when timeout is enabled
shy950521 edited this page Mar 1, 2021
·
2 revisions
Here is an example for a conflict occurred with only one user when read timeout is enabled:
- the client sends a empty put request 1.a to ECS
- >60s with no response for 1.a, thus, the client send a retry request 1.b
- 1.b get 200 response
- then the client update the object with request 2, also get 200 response
- At this point request 1.a actually succeeded on ECS, the update 2 was overwrite to empty.
Usage:
In #1, add headers to the requestrequest.withIfMatch(null).withIfNoneMatch("*")
; this will only create the object when it does not exist
Similarly, when you want to sequentially update an object, you can use request.withIfUnmodifiedSince(null).withIfMatch(lastEtag)
; to ensure it just follows the previous update
How to enable read timeout: s3Config.setReadTimeout(milliseconds)