zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanm <...@git.apache.org>
Subject [GitHub] zookeeper pull request #580: ZOOKEEPER-3098: Add additional server metrics
Date Mon, 10 Sep 2018 22:13:24 GMT
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? 


---

Mime
View raw message