arp7 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_r387106804
 
 

 ##########
 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 don't think we need to preserve protocol compatibility with old clients 
right now since we don't have rolling upgrades. As long as the old chunks are 
still readable after upgrade on DN we should be fine.

----------------------------------------------------------------
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