From 9cbc493bb66d3b2ee6f1bda1fe91e00d9ad3e2bb Mon Sep 17 00:00:00 2001 From: Navneet Verma Date: Tue, 31 Dec 2024 23:31:49 -0800 Subject: [PATCH] Fixed the chunk ordering of s3 multi-part uploads Signed-off-by: Navneet Verma --- src/main/java/org/opensearch/knn/remote/index/s3/S3Client.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/opensearch/knn/remote/index/s3/S3Client.java b/src/main/java/org/opensearch/knn/remote/index/s3/S3Client.java index 0086fa74a..2e5a7df4b 100644 --- a/src/main/java/org/opensearch/knn/remote/index/s3/S3Client.java +++ b/src/main/java/org/opensearch/knn/remote/index/s3/S3Client.java @@ -40,6 +40,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.concurrent.BlockingQueue; import java.util.concurrent.CompletableFuture; @@ -269,7 +270,7 @@ public long uploadWithProgress(final InputStream inputStream, final String key) // totalBytesUploaded += partData.length; // progressCallback.onProgress(totalBytesUploaded); } - + completedParts.sort(Comparator.comparingInt(CompletedPart::partNumber)); // Complete the multipart upload CompletedMultipartUpload completedMultipartUpload = CompletedMultipartUpload.builder().parts(completedParts).build();