From dev-return-72949-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Tue Sep 11 00:13:27 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 9FEEC180656 for ; Tue, 11 Sep 2018 00:13:26 +0200 (CEST) Received: (qmail 45372 invoked by uid 500); 10 Sep 2018 22:13:25 -0000 Mailing-List: contact dev-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list dev@zookeeper.apache.org Received: (qmail 45350 invoked by uid 99); 10 Sep 2018 22:13:25 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Sep 2018 22:13:24 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DD56BDFF2E; Mon, 10 Sep 2018 22:13:24 +0000 (UTC) From: hanm To: dev@zookeeper.apache.org Reply-To: dev@zookeeper.apache.org References: In-Reply-To: Subject: [GitHub] zookeeper pull request #580: ZOOKEEPER-3098: Add additional server metrics Content-Type: text/plain Message-Id: <20180910221324.DD56BDFF2E@git1-us-west.apache.org> Date: Mon, 10 Sep 2018 22:13:24 +0000 (UTC) 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? ---