diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java index 1636f24a95..b84db66840 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java @@ -268,7 +268,7 @@ public CompletableFuture query(Message request) { } } - private LogEntryProto readStateMachineData(SMLogEntryProto smLogEntryProto, + private LogEntryProto readStateMachineData(LogEntryProto entry, ContainerCommandRequestProto requestProto) { WriteChunkRequestProto writeChunkRequestProto = requestProto.getWriteChunk(); @@ -307,18 +307,18 @@ private LogEntryProto readStateMachineData(SMLogEntryProto smLogEntryProto, ContainerCommandRequestProto.newBuilder(requestProto) .setWriteChunk(dataWriteChunkProto); - return recreateLogEntryProto(smLogEntryProto, + return recreateLogEntryProto(entry, newStateMachineProto.build().toByteString()); } - private LogEntryProto recreateLogEntryProto(SMLogEntryProto smLogEntryProto, + private LogEntryProto recreateLogEntryProto(LogEntryProto entry, ByteString stateMachineData) { // recreate the log entry final SMLogEntryProto log = - SMLogEntryProto.newBuilder(smLogEntryProto) + SMLogEntryProto.newBuilder(entry.getSmLogEntry()) .setStateMachineData(stateMachineData) .build(); - return LogEntryProto.newBuilder().setSmLogEntry(log).build(); + return LogEntryProto.newBuilder(entry).setSmLogEntry(log).build(); } /** @@ -360,11 +360,11 @@ public CompletableFuture readStateMachineData( if (requestProto.getCmdType() == Type.WriteChunk) { return CompletableFuture.supplyAsync(() -> - readStateMachineData(smLogEntryProto, requestProto), + readStateMachineData(entry, requestProto), chunkExecutor); } else if (requestProto.getCmdType() == Type.CreateContainer) { LogEntryProto log = - recreateLogEntryProto(smLogEntryProto, requestProto.toByteString()); + recreateLogEntryProto(entry, requestProto.toByteString()); return CompletableFuture.completedFuture(log); } else { throw new IllegalStateException("Cmd type:" + requestProto.getCmdType()