-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Resolve GCS-fixture batch-delete inconsistencies #139166
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) |
| new TestHttpResponse(RestStatus.OK, """ | ||
| --$boundary | ||
| Content-Length: 168 | ||
| Content-Type: application/http | ||
| content-id: 1 | ||
| content-transfer-encoding: binary | ||
| content-type: application/http | ||
| content-id: response-1 | ||
| HTTP/1.1 204 NO_CONTENT | ||
| HTTP/1.1 204 No Content | ||
| --$boundary-- | ||
| """.replace("\n", "\r\n").replace("$boundary", boundary)), | ||
| --$boundary--""".replace("\n", "\r\n").replace("$boundary", boundary)), |
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.
Here is a complete example of inconsistencies.
- Content-Length is redundant and wrong, it's 23 bytes + double CRLF.
content-transfer-encoding: binaryis not true.content-id: 1does not have prefixresponse-.- There should be only 2(or even 1) empty lines after
HTTP/1.1 204 No Content
example here https://docs.cloud.google.com/storage/docs/batch#batch-example-response
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
| var _bucket = matcher.group("bucket"); | ||
| if (bucket.equals(_bucket) == false) { | ||
| throw new IllegalStateException("Bucket does not match expected: " + bucket + ", got: " + _bucket); | ||
| } |
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.
I wonder if we should maybeDieOnAnotherThread if we see what we consider to be a malformed request here. If we just throw an exception here it might retry around the issue somehow and we don't know we've got some issue with our stub.
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.
Thank you, I will add it to the following PR.
nicktindall
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
joshua-adams-1
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!
This PR addresses various inconsistencies in GCS fixture for batch-delete. Source https://docs.cloud.google.com/storage/docs/batch#http.
It is a prerequisite for #138951 to handle retryable errors per batch item. And eventually fix #138364.
This PR addresses following issues:
Content-Length,Content-Type,Content-Transfer-Encoding. These are not required for batch delete responses.Content-IDheader does not align in responses. Responses should have aresponse-prefix with a Content-ID header value from request. For example request:Content-ID: 1, response:Content-ID: response-1.Future work will address remaining issues:
204 No Contenteven if item is not found. In that case it should be404 Not Found.Major change is taking out
Multipart.ReaderfromMultipartUploadand reuse it for batch request. Also addMultipart.Writerfor writing batch responses.