You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2019/12/04 15:16:52 UTC

[GitHub] [hadoop-ozone] lokeshj1703 commented on a change in pull request #298: HDDS-2389. add toStateMachineLogEntryString provider in Ozone's ContainerStateMachine.

lokeshj1703 commented on a change in pull request #298: HDDS-2389. add toStateMachineLogEntryString provider in Ozone's ContainerStateMachine.
URL: https://github.com/apache/hadoop-ozone/pull/298#discussion_r353802584
 
 

 ##########
 File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java
 ##########
 @@ -862,4 +864,48 @@ public void notifyLeaderChanged(RaftGroupMemberId groupMemberId,
                                   RaftPeerId raftPeerId) {
     ratisServer.handleLeaderChangedNotification(groupMemberId, raftPeerId);
   }
+
+  @Override
+  public String toStateMachineLogEntryString(StateMachineLogEntryProto proto) {
+    try {
+      ContainerCommandRequestProto requestProto =
+              getContainerCommandRequestProto(proto.getLogData());
+      return getWriteChunkInfo(requestProto);
+    } catch (Throwable t) {
+      return "";
+    }
+  }
+
+  private String getWriteChunkInfo(ContainerCommandRequestProto requestProto) {
+    StringBuilder builder = new StringBuilder();
+    Preconditions.checkArgument(requestProto.getCmdType() == Type.WriteChunk);
+
+    long contId = requestProto.getContainerID();
+    WriteChunkRequestProto wc = requestProto.getWriteChunk();
+
+    builder.append("cmd=");
+    builder.append(requestProto.getCmdType().toString());
+
+    builder.append(", container id=");
+    builder.append(contId);
+
+    builder.append(", blockid=");
+    builder.append(contId);
 
 Review comment:
   We can omit this as we are already printing the containerID earlier.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org