Github user hanm commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/580#discussion_r216487862
  
    --- Diff: src/java/main/org/apache/zookeeper/server/quorum/Follower.java ---
    @@ -86,7 +89,13 @@ void followLeader() throws InterruptedException {
                                 + " is less than our accepted epoch " + 
ZxidUtils.zxidToString(self.getAcceptedEpoch()));
                         throw new IOException("Error: Epoch of leader is 
lower");
                     }
    -                syncWithLeader(newEpochZxid);                
    +                long startTime = Time.currentElapsedTime();
    +                try {
    +                    syncWithLeader(newEpochZxid);
    +                } finally {
    +                    long syncTime = Time.currentElapsedTime() - startTime;
    +                    ServerMetrics.FOLLOWER_SYNC_TIME.add(syncTime);
    --- End diff --
    
    This will execute regardless of `syncWithLeader` succeeded or not. Should 
we only collect `syncTime` for the syncs that were successful? 


---

Reply via email to