Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 10EC5200C52 for ; Mon, 10 Apr 2017 15:04:46 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0F939160B99; Mon, 10 Apr 2017 13:04:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 557A9160B85 for ; Mon, 10 Apr 2017 15:04:45 +0200 (CEST) Received: (qmail 86950 invoked by uid 500); 10 Apr 2017 13:04:44 -0000 Mailing-List: contact dev-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list dev@kafka.apache.org Received: (qmail 86939 invoked by uid 99); 10 Apr 2017 13:04:44 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Apr 2017 13:04:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id C9FC6C1444 for ; Mon, 10 Apr 2017 13:04:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.502 X-Spam-Level: X-Spam-Status: No, score=-99.502 tagged_above=-999 required=6.31 tests=[KAM_NUMSUBJECT=0.5, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id cSOscfnA_mho for ; Mon, 10 Apr 2017 13:04:42 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 8E8585FD84 for ; Mon, 10 Apr 2017 13:04:42 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 11388E055F for ; Mon, 10 Apr 2017 13:04:42 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 9A05C24066 for ; Mon, 10 Apr 2017 13:04:41 +0000 (UTC) Date: Mon, 10 Apr 2017 13:04:41 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@kafka.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (KAFKA-5036) Followups from KIP-101 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 10 Apr 2017 13:04:46 -0000 [ https://issues.apache.org/jira/browse/KAFKA-5036?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15962819#comment-15962819 ] ASF GitHub Bot commented on KAFKA-5036: --------------------------------------- GitHub user benstopford opened a pull request: https://github.com/apache/kafka/pull/2831 MINOR: KAFKA-5036 (points 2, 5): Refactor caching of Latest Epoch This PR covers point (2) and point (5) from KAFKA-5036: 2. Currently, we update the leader epoch in epochCache after log append in the follower but before log append in the leader. It would be more consistent to always do this after log append. This also avoids issues related to failure in log append. 5. The constructor of LeaderEpochFileCache has the following: lock synchronized { ListBuffer(checkpoint.read(): _*) } But everywhere else uses a read or write lock. We should use consistent locking. This is a refactor to the way epochs are cached, replacing the code to cache the latest epoch in the LeaderEpochFileCache by reusing the cached value in Partition. There is no functional change. You can merge this pull request into a Git repository by running: $ git pull https://github.com/benstopford/kafka KAFKA-5036-part2-second-try Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/2831.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2831 ---- commit 3e9c130672824070968173b2991a43eb9fa139b6 Author: Ben Stopford Date: 2017-04-10T12:56:48Z KAFKA-5036: Refactor the caching of the latest epoch. Workflow is simpler if we resuse the value cached in partition. ---- > Followups from KIP-101 > ---------------------- > > Key: KAFKA-5036 > URL: https://issues.apache.org/jira/browse/KAFKA-5036 > Project: Kafka > Issue Type: Improvement > Affects Versions: 0.11.0.0 > Reporter: Jun Rao > Assignee: Jun Rao > Fix For: 0.11.0.0 > > > 1. It would be safer to hold onto the leader lock in Partition while serving an OffsetForLeaderEpoch request. > 2. Currently, we update the leader epoch in epochCache after log append in the follower but before log append in the leader. It would be more consistent to always do this after log append. This also avoids issues related to failure in log append. > 3. OffsetsForLeaderEpochRequest/OffsetsForLeaderEpochResponse: > The code that does grouping can probably be replaced by calling CollectionUtils.groupDataByTopic(). Done: https://github.com/apache/kafka/commit/359a68510801a22630a7af275c9935fb2d4c8dbf > 4. The following line in LeaderEpochFileCache is hit several times when LogTest is executed: > {code} > if (cachedLatestEpoch == None) error("Attempt to assign log end offset to epoch before epoch has been set. This should never happen.") > {code} > 5. The constructor of LeaderEpochFileCache has the following: > {code} > lock synchronized { ListBuffer(checkpoint.read(): _*) } > {code} > But everywhere else uses a read or write lock. We should use consistent locking. -- This message was sent by Atlassian JIRA (v6.3.15#6346)