Fix S3RepositoryThirdPartyTests.testReadFromPositionLargerThanBlobLength#106466
Merged
tlrx merged 5 commits intoelastic:mainfrom Mar 22, 2024
Merged
Fix S3RepositoryThirdPartyTests.testReadFromPositionLargerThanBlobLength#106466tlrx merged 5 commits intoelastic:mainfrom
tlrx merged 5 commits intoelastic:mainfrom
Conversation
The test should use a random operation purpose that is not "Indices", otherwise S3RetryingInputStream retries up to Integer.MAX_VALUE times which causes the test suite to timeout. Also fixes the progress in the retries log messages. Relates elastic#106457
Collaborator
|
Pinging @elastic/es-distributed (Team:Distributed) |
| this.currentStreamFirstOffset = Math.addExact(start, currentOffset); | ||
| final S3Object s3Object = SocketAccess.doPrivileged(() -> clientReference.client().getObject(getObjectRequest)); | ||
| this.currentStreamLastOffset = Math.addExact(currentStreamFirstOffset, getStreamLength(s3Object)); | ||
| this.currentStream = s3Object.getObjectContent(); |
Contributor
There was a problem hiding this comment.
Was it intentionally moved?
Member
Author
There was a problem hiding this comment.
Yes. If the request fails, currentStreamFirstOffset is not updated and currentStreamProgress() reports an inaccurate number.
idegtiarenko
approved these changes
Mar 19, 2024
Contributor
idegtiarenko
left a comment
There was a problem hiding this comment.
Thanks for a quick fix!
DaveCTurner
requested changes
Mar 19, 2024
Member
DaveCTurner
left a comment
There was a problem hiding this comment.
Hmm I think we shouldn't be retrying on a 416, regardless of the purpose. Could we try that instead.
Member
Author
I think you're right. I pushed some changes, let me know what you (both) think |
idegtiarenko
approved these changes
Mar 19, 2024
DaveCTurner
approved these changes
Mar 19, 2024
Comment on lines
+261
to
+263
| var cause = exception.getRootCause(); | ||
| assertThat(cause, instanceOf(AmazonS3Exception.class)); | ||
| assertThat(((AmazonS3Exception) cause).getStatusCode(), equalTo(RestStatus.REQUESTED_RANGE_NOT_SATISFIED.getStatus())); |
Member
There was a problem hiding this comment.
nit/one-liner suggestion:
Suggested change
| var cause = exception.getRootCause(); | |
| assertThat(cause, instanceOf(AmazonS3Exception.class)); | |
| assertThat(((AmazonS3Exception) cause).getStatusCode(), equalTo(RestStatus.REQUESTED_RANGE_NOT_SATISFIED.getStatus())); | |
| assertThat( | |
| asInstanceOf(AmazonS3Exception.class, exception.getRootCause()).getStatusCode(), | |
| equalTo(RestStatus.REQUESTED_RANGE_NOT_SATISFIED.getStatus()) | |
| ); |
Member
Author
|
Thanks both! |
This was referenced Mar 25, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The test should use a random operation purpose that is not "Indices", otherwise S3RetryingInputStream retries up to Integer.MAX_VALUE times which causes the test suite to timeout.
Also fixes the progress in the retries log messages.
Closes #106457