captainzmc commented on a change in pull request #3195:
URL: https://github.com/apache/ozone/pull/3195#discussion_r829169362



##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/impl/KeyValueStreamDataChannel.java
##########
@@ -18,17 +18,90 @@
 
 package org.apache.hadoop.ozone.container.keyvalue.impl;
 
+import com.google.common.base.Preconditions;
 import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
+import 
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandRequestProto;
+import org.apache.hadoop.hdds.ratis.ContainerCommandRequestMessage;
+import org.apache.hadoop.hdds.scm.ByteStringConversion;
 import 
org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException;
 import org.apache.hadoop.ozone.container.common.helpers.ContainerMetrics;
 import org.apache.hadoop.ozone.container.common.impl.ContainerData;
+import org.apache.ratis.thirdparty.com.google.protobuf.ByteString;
+import org.apache.ratis.thirdparty.io.netty.buffer.ByteBuf;
+import org.apache.ratis.thirdparty.io.netty.buffer.Unpooled;
 
 import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Deque;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.function.Function;
+
+import org.apache.hadoop.hdds.scm.storage.BlockDataStreamOutput;
 
 /**
  * This class is used to get the DataChannel for streaming.
  */
-class KeyValueStreamDataChannel extends StreamDataChannelBase {
+public class KeyValueStreamDataChannel extends StreamDataChannelBase {
+  private static final ByteBuffer[] EMPTY = {};
+  private static final Function<ByteBuffer, ByteString> CONVERTER
+      // TODO: pass OzoneConfigKeys.OZONE_UNSAFEBYTEOPERATIONS_ENABLED
+      = ByteStringConversion.createByteBufferConversion(false);
+
+  /**
+   * Keep the last {@link BlockDataStreamOutput#PUT_BLOCK_REQUEST_LENGTH_MAX}
+   * bytes in the buffer in order to create putBlockRequest at {@link 
#close()}.
+   */
+  private static class Buffers {
+    private final Deque<ByteBuffer> deque = new LinkedList<>();
+    private int length;
+
+    private boolean isExtra(int n) {
+      return length - n >= BlockDataStreamOutput.PUT_BLOCK_REQUEST_LENGTH_MAX;

Review comment:
       Hi @szetszwo , what is the purpose of being greater than 1M?




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to