-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Refactor S3 conditional operations #139265
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
base: main
Are you sure you want to change the base?
Conversation
|
Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination) |
DaveCTurner
left a comment
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.
Production code looks good (one nit) but a couple of concerns about the test changes.
| final boolean failIfAlreadyExists | ||
| final ConditionalOperation condition | ||
| ) throws IOException { | ||
| try (var clientReference = s3BlobStore.clientReference()) { |
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.
We don't need this clientReference if we're going to acquire another one within putObject(...)
| if (failIfAlreadyExists) { | ||
| assertEquals("*", request.ifNoneMatch()); |
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.
Does this work with the change to randomCondition()?
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.
Sometimes :)
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.
Thanks! Fixed 2b71ea3
| if (failIfAlreadyExists) { | ||
| assertEquals("*", compRequest.ifNoneMatch()); |
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.
Likewise I'm suspicious about this bit with the change to randomCondition().
DaveCTurner
left a comment
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.
LGTM (I pushed 1bab786 to strengthen the tests slightly)
Add S3 ConditionalOperation enumeration for stronger type-check on mutually exclusive conditions:
None,If-None-Match, andIf-Match. https://docs.aws.amazon.com/AmazonS3/latest/userguide/conditional-requests.html