Pengzna commented on code in PR #12723:
URL: https://github.com/apache/iotdb/pull/12723#discussion_r1637431213


##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/pipe/PipeConsensusServerImpl.java:
##########
@@ -274,21 +282,45 @@ public synchronized void 
checkConsensusPipe(Map<ConsensusPipeName, PipeStatus> e
 
   public TSStatus write(IConsensusRequest request) {
     try {
+      long consensusWriteStartTime = System.nanoTime();
       stateMachineLock.lock();
+      long getStateMachineLockTime = System.nanoTime();
+      // statistic the time of acquiring stateMachine lock
+      pipeConsensusServerMetrics.recordGetStateMachineLockTime(
+          getStateMachineLockTime - consensusWriteStartTime);
       if (request instanceof ComparableConsensusRequest) {
         ((ComparableConsensusRequest) request)
             
.setProgressIndex(progressIndexManager.assignProgressIndex(thisNode.getGroupId()));
       }
-      return stateMachine.write(request);
+
+      long writeToStateMachineStartTime = System.nanoTime();
+      TSStatus result = stateMachine.write(request);
+      long writeToStateMachineEndTime = System.nanoTime();
+      // statistic the time of writing request into stateMachine
+      pipeConsensusServerMetrics.recordWriteStateMachineTime(

Review Comment:
   Good catch! fixed



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

Reply via email to