bshashikant commented on a change in pull request #551: HDDS-2717. Handle chunk 
increments in datanode
URL: https://github.com/apache/hadoop-ozone/pull/551#discussion_r386368545
 
 

 ##########
 File path: 
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java
 ##########
 @@ -360,20 +360,33 @@ private void watchForCommit(boolean bufferFull) throws 
IOException {
   }
 
   private CompletableFuture<ContainerProtos.
-      ContainerCommandResponseProto> executePutBlock()
-      throws IOException {
+      ContainerCommandResponseProto> executePutBlock(boolean close,
+      boolean force) throws IOException {
     checkOpen();
     long flushPos = totalDataFlushedLength;
-    Preconditions.checkNotNull(bufferList);
-    final List<ChunkBuffer> byteBufferList = bufferList;
-    bufferList = null;
-    Preconditions.checkNotNull(byteBufferList);
+    final List<ChunkBuffer> byteBufferList;
+    if (!force) {
+      Preconditions.checkNotNull(bufferList);
+      byteBufferList = bufferList;
+      bufferList = null;
+      Preconditions.checkNotNull(byteBufferList);
+    } else {
+      byteBufferList = null;
+    }
 
     CompletableFuture<ContainerProtos.
         ContainerCommandResponseProto> flushFuture;
     try {
+      BlockData blockData = containerBlockData.build();
+      if (close) {
+        blockData = BlockData.newBuilder(blockData)
+            .addMetadata(KeyValue.newBuilder()
+                .setKey(OzoneConsts.LAST_PUT_FOR_BLOCK)
+                .setValue(Boolean.TRUE.toString()))
+            .build();
+      }
 
 Review comment:
   I think it will bring in compatibility issues with the older client with no 
explicit close option set and latest server jar with new containers which will 
expect an explicit close option set? Are we ok with this?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org

Reply via email to