You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2020/10/16 02:28:16 UTC

[GitHub] [iotdb] neuyilan commented on a change in pull request #1827: [Distributed]fix code smell

neuyilan commented on a change in pull request #1827:
URL: https://github.com/apache/iotdb/pull/1827#discussion_r505994733



##########
File path: cluster/src/main/java/org/apache/iotdb/cluster/log/LogDispatcher.java
##########
@@ -244,25 +244,20 @@ private void appendEntriesAsync(List<ByteBuffer> logList, AppendEntriesRequest r
     private void appendEntriesSync(List<ByteBuffer> logList, AppendEntriesRequest request,
         List<SendLogRequest> currBatch) {
 
-      long start;
-      if (Timer.ENABLE_INSTRUMENTING) {
-        start = System.nanoTime();
-      }
+      Timer.Statistic.RAFT_SENDER_WAIT_FOR_PREV_LOG.setStartTime();
       if (!member.waitForPrevLog(peer, currBatch.get(0).getLog())) {
         logger.warn("{}: node {} timed out when appending {}", member.getName(), receiver,
             currBatch.get(0).getLog());
         return;
       }
-      Timer.Statistic.RAFT_SENDER_WAIT_FOR_PREV_LOG.addNanoFromStart(start);
+      Timer.Statistic.RAFT_SENDER_WAIT_FOR_PREV_LOG.calCostTime();

Review comment:
       you're right, its indeed cause concurrent problem, I'll fix it. thanks!




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