Skip to content

PR 5164 remaining comments #5403

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

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,15 @@ default SplitResult<ResponseT, ResultT> split(SplittingTransformerConfiguration
.build();
}

/**
* Creates an {@link SplitResult} which contains an {@link SplittingTransformer} that splits the
* {@link AsyncResponseTransformer} into multiple ones, publishing them as a {@link SdkPublisher}.
*
* @param splitConfig configuration for the split transformer
* @return SplitAsyncResponseTransformer instance.
* @see SplittingTransformer
* @see SplitResult
*/
default SplitResult<ResponseT, ResultT> split(Consumer<SplittingTransformerConfiguration.Builder> splitConfig) {
SplittingTransformerConfiguration conf = SplittingTransformerConfiguration.builder()
.applyMutation(splitConfig)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ public void exceptionOccurred(Throwable throwable) {
}
if (cf != null) {
cf.completeExceptionally(throwable);
} else {
log.warn(() -> "An exception occurred before the call to prepare() was able to instantiate the CompletableFuture."
+ "The future cannot be completed exceptionally because it is null");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ public void request(long n) {
downstreamSubscriber.onError(new IllegalArgumentException("Amount requested must be positive"));
return;
}
if (isCancelled.get()) {
return;
}
long newDemand = outstandingDemand.updateAndGet(current -> {
if (Long.MAX_VALUE - current < n) {
return Long.MAX_VALUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import software.amazon.awssdk.core.FileTransformerConfiguration.FileWriteOption;
import software.amazon.awssdk.core.FileTransformerConfiguration.FailureBehavior;
import software.amazon.awssdk.core.async.SdkPublisher;
import software.amazon.awssdk.core.util.FileUtils;

/**
* Tests for {@link FileAsyncResponseTransformer}.
Expand Down Expand Up @@ -335,9 +334,9 @@ private static void stubException(String newContent, FileAsyncResponseTransforme
transformer.onStream(SdkPublisher.adapt(Flowable.just(content, content)));
transformer.exceptionOccurred(runtimeException);

assertThatThrownBy(() -> future.get(10, TimeUnit.SECONDS))
.hasRootCause(runtimeException);
assertThat(future.isCompletedExceptionally()).isTrue();
assertThat(future).failsWithin(1, TimeUnit.SECONDS)
.withThrowableOfType(ExecutionException.class)
.withCause(runtimeException);
}

private static SdkPublisher<ByteBuffer> testPublisher(String content) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private ResumableRequestConverter() {
return Pair.of(originalDownloadRequest, responseTransformer);
}

// ranged GET for the remaining bytes (as a single request, no multipart)
// ranged GET for the remaining bytes.
newDownloadFileRequest = resumedDownloadFileRequest(resumableFileDownload,
originalDownloadRequest,
getObjectRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ private MultipartDownloaderSubscriber subscriber(GetObjectRequest getObjectReque
}

private void logSinglePartMessage(GetObjectRequest getObjectRequest) {
String reason = "";
if (getObjectRequest.range() != null) {
reason = " because getObjectRequest range is included in the request."
+ " range = " + getObjectRequest.range();
} else if (getObjectRequest.partNumber() != null) {
reason = " because getObjectRequest part number is included in the request."
+ " part number = " + getObjectRequest.partNumber();
}
String finalReason = reason;
log.debug(() -> "Using single part download" + finalReason);
log.debug(() -> {
String reason = "";
if (getObjectRequest.range() != null) {
reason = " because getObjectRequest range is included in the request."
+ " range = " + getObjectRequest.range();
} else if (getObjectRequest.partNumber() != null) {
reason = " because getObjectRequest part number is included in the request."
+ " part number = " + getObjectRequest.partNumber();
}
return "Using single part download" + reason;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ public int highestSequentialCompletedPart() {
return 1;
}

// for sequential operation, make sure we don't skip any non-completed part by returning the
// highest sequentially completed part
int previous = completedParts.first();
for (Integer i : completedParts) {
if (i - previous > 1) {
Expand Down
Loading