yandrey321 commented on code in PR #10365:
URL: https://github.com/apache/ozone/pull/10365#discussion_r3305699265


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java:
##########
@@ -685,6 +707,115 @@ private void 
handleCommandResult(ContainerCommandRequestProto requestProto, long
     }
   }
 
+  /**
+   * Writes PutBlock metadata to RocksDB inside {@link 
StateMachine.DataApi#write()}, before Raft quorum.
+   * This ensures every node that ACKs the log entry has already persisted the 
block metadata,
+   * eliminating the gap where a follower crashes after the leader commits but 
before the follower
+   * runs {@link #applyTransaction(TransactionContext)}.
+   *
+   * <p>Ordering: waits for all preceding WriteChunk {@code raftFuture}s to 
complete before
+   * dispatching so that {@code finishWriteChunks()} inside {@link 
KeyValueHandler#handlePutBlock}
+   * always sees fully written chunk files.
+   *
+   * <p>{@link #applyTransaction(TransactionContext)} becomes a no-op for 
PutBlock because
+   * {@code persistPutBlock()} detects the already-written BCSID and returns 
early.
+   */
+  private CompletableFuture<Message> writePutBlockData(

Review Comment:
   it should be refactored to smaller functions to improve readability



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