ChenSammi commented on code in PR #5783:
URL: https://github.com/apache/ozone/pull/5783#discussion_r1433885710


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -562,6 +565,47 @@ ContainerCommandResponseProto handlePutBlock(
     return putBlockResponseSuccess(request, blockDataProto);
   }
 
+  ContainerCommandResponseProto handleFinalizeBlock(
+      ContainerCommandRequestProto request, KeyValueContainer kvContainer) {
+
+    if (!request.hasFinalizeBlock()) {
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("Malformed Finalize block request. trace ID: {}",
+            request.getTraceID());
+      }
+      return malformedRequest(request);
+    }
+    ContainerProtos.BlockData responseData;
+
+    try {
+      checkContainerOpen(kvContainer);
+      BlockID blockID = BlockID.getFromProtobuf(
+          request.getFinalizeBlock().getBlockID());
+      Preconditions.checkNotNull(blockID);
+
+      LOG.info("Finalized Block request received {} ", blockID);
+
+      responseData = blockManager.getBlock(kvContainer, blockID)
+          .getProtoBufMessage();
+
+      chunkManager.finalizeWriteChunk(kvContainer, blockID);
+      kvContainer.getContainerData()
+          .addToFinalizedBlockSet(blockID.getLocalID());
+      blockManager.finalizeBlock(kvContainer,

Review Comment:
   Please first save the block to rocksdb, then put the block into memory set.



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