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


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java:
##########
@@ -508,13 +516,15 @@ public TransactionContext 
startTransaction(RaftClientRequest request)
       if (!blockAlreadyFinalized) {
         Preconditions.checkArgument(write.hasData());
         Preconditions.checkArgument(!write.getData().isEmpty());
-        final WriteChunkRequestProto.Builder commitWriteChunkProto = 
WriteChunkRequestProto.newBuilder(write)
-            .clearData();
-        protoBuilder.setWriteChunk(commitWriteChunkProto)
-            .setPipelineID(getGroupId().getUuid().toString())
+        // Set metadata fields while the write chunk still contains data, then 
snapshot.
+        protoBuilder.setPipelineID(getGroupId().getUuid().toString())
             .setTraceID(proto.getTraceID());
-
-        builder.setStateMachineData(write.getData());
+        // fullProtoWithData: token cleared, pipelineID set, chunk data 
present — travels in AppendEntries.
+        fullProtoWithData = protoBuilder.build();
+        // Strip data for the WAL entry (logProto).
+        
protoBuilder.setWriteChunk(WriteChunkRequestProto.newBuilder(write).clearData());
+        // stateMachineData carries the full proto so followers can parse it 
directly.
+        builder.setStateMachineData(fullProtoWithData.toByteString());

Review Comment:
   Do you mean a case like rolling upgrade when different versions of datanodes 
would be present at the same time? Let me think about it. 



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