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

 ##########
 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:
   Good point, but that's only part of the problem.  Old client is anyway 
incompatible with new layout because it always sends 0 offset.  If backward 
compatibility is required, I think we would need to force old layout for old 
client.  For this, even block allocation needs to account for client version.

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