You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/12/13 14:02:13 UTC

[GitHub] [beam] mosche commented on a change in pull request #16205: [BEAM-13445] Correctly set data limit when flushing S3 upload buffer

mosche commented on a change in pull request #16205:
URL: https://github.com/apache/beam/pull/16205#discussion_r767783742



##########
File path: sdks/java/io/amazon-web-services/src/main/java/org/apache/beam/sdk/io/aws/s3/S3WritableByteChannel.java
##########
@@ -118,13 +118,22 @@ public int write(ByteBuffer sourceBuffer) throws IOException {
 
     int totalBytesWritten = 0;
     while (sourceBuffer.hasRemaining()) {
+      int position = sourceBuffer.position();
       int bytesWritten = Math.min(sourceBuffer.remaining(), uploadBuffer.remaining());
       totalBytesWritten += bytesWritten;
 
-      byte[] copyBuffer = new byte[bytesWritten];
-      sourceBuffer.get(copyBuffer);
-      uploadBuffer.put(copyBuffer);
-      md5.update(copyBuffer);
+      if (sourceBuffer.hasArray()) {

Review comment:
       @aromanenko-dev I added some comments to explain. Is that sufficient?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org