Implement reset methods for XXHash checksum algorithms#6762
Conversation
| @@ -120,7 +120,6 @@ public void asyncNonStreamingOperation_payloadSizeLessThanCompressionThreshold_d | |||
| public void asyncStreamingOperation_compressionEnabled_compressesCorrectly() { | |||
| mockAsyncHttpClient.stubNextResponse(mockResponse(), Duration.ofMillis(500)); | |||
|
|
|||
| mockAsyncHttpClient.setAsyncRequestBodyLength(compressedBody.length()); | |||
There was a problem hiding this comment.
Removed this because MockAsyncHttpClient now always captures the streaming request payload, so pre-configuring the expected body length is no longer needed.
| byte[] bytes = new byte[buffer.remaining()]; | ||
| buffer.get(bytes); | ||
| byteBuffer.put(bytes); | ||
| invokeSafely(() -> baos.write(BinaryUtils.copyBytesFrom(buffer))); |
There was a problem hiding this comment.
We should technically call request.subscription(1) here, but it'd trigger a bug in InMemoryPublisher that causes the request to hang. I'll fix it later. This shouldn't cause any real issues though since InMemoryPublisher only invokes onNext once.
|
Added |
|
|
This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one. |


Motivation and Context
XxHashChecksum.reset() previously threw
UnsupportedOperationException, causing exception to be thrown from async streaming operations that use this checksum (no services use this today). This change implements reset() to properly close the old CRT resource and create a fresh instance. The root cause is thatChunkedEncodedPublisherresets all states including checksum in subscribeaws-sdk-java-v2/core/http-auth-aws/src/main/java/software/amazon/awssdk/http/auth/aws/internal/signer/chunkedencoding/ChunkedEncodedPublisher.java
Lines 91 to 92 in 049935f
Additionally,
HttpChecksumCalculationTestrelied on Mockito mocks with manual ArgumentCaptor wiring. This refactors it to use MockSyncHttpClient/MockAsyncHttpClient from service-test-utils, and adds full request body verification for streaming checksum trailer tests.
Modifications
unused setAsyncRequestBodyLength
Testing
XXHASH3, XXHASH64, XXHASH128)
Types of changes
Checklist
License