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 AF06B200C04 for ; Tue, 24 Jan 2017 21:40:36 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id AD9A4160B3E; Tue, 24 Jan 2017 20:40:36 +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 02A9D160B38 for ; Tue, 24 Jan 2017 21:40:35 +0100 (CET) Received: (qmail 90908 invoked by uid 500); 24 Jan 2017 20:40:30 -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 90875 invoked by uid 99); 24 Jan 2017 20:40:29 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jan 2017 20:40:29 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 6ED36C116B for ; Tue, 24 Jan 2017 20:40:29 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.198 X-Spam-Level: X-Spam-Status: No, score=-1.198 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id g2HWSj2eOWiK for ; Tue, 24 Jan 2017 20:40:28 +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 4DAEC5FBE1 for ; Tue, 24 Jan 2017 20:40:28 +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 3A6E0E03A7 for ; Tue, 24 Jan 2017 20:40:27 +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 9F81425290 for ; Tue, 24 Jan 2017 20:40:26 +0000 (UTC) Date: Tue, 24 Jan 2017 20:40:26 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@kafka.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (KAFKA-4547) Consumer.position returns incorrect results for Kafka 0.10.1.0 client MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 24 Jan 2017 20:40:36 -0000 [ https://issues.apache.org/jira/browse/KAFKA-4547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15836603#comment-15836603 ] ASF GitHub Bot commented on KAFKA-4547: --------------------------------------- GitHub user vahidhashemian opened a pull request: https://github.com/apache/kafka/pull/2431 KAFKA-4547 (0.10.1 hotfix): Avoid unnecessary offset commit that could lead to an invalid offset position if partition is paused You can merge this pull request into a Git repository by running: $ git pull https://github.com/vahidhashemian/kafka KAFKA-4547-0.10.1 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/2431.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 #2431 ---- commit 836287820dd86c91dc422b30406aa20696996aa7 Author: Vahid Hashemian Date: 2017-01-24T20:16:02Z KAFKA-4547 (0.10.1 hotfix): Avoid unnecessary offset commit that could lead to an invalid offset position if partition is paused ---- > Consumer.position returns incorrect results for Kafka 0.10.1.0 client > --------------------------------------------------------------------- > > Key: KAFKA-4547 > URL: https://issues.apache.org/jira/browse/KAFKA-4547 > Project: Kafka > Issue Type: Bug > Components: clients > Affects Versions: 0.10.1.0, 0.10.0.2, 0.10.1.1 > Environment: Windows Kafka 0.10.1.0 > Reporter: Pranav Nakhe > Assignee: Vahid Hashemian > Priority: Blocker > Labels: clients > Fix For: 0.10.2.0 > > Attachments: issuerep.zip > > > Consider the following code - > KafkaConsumer consumer = new KafkaConsumer(props); > List listOfPartitions = new ArrayList(); > for (int i = 0; i < consumer.partitionsFor("IssueTopic").size(); i++) { > listOfPartitions.add(new TopicPartition("IssueTopic", i)); > } > consumer.assign(listOfPartitions); > consumer.pause(listOfPartitions); > consumer.seekToEnd(listOfPartitions); > // consumer.resume(listOfPartitions); -- commented out > for(int i = 0; i < listOfPartitions.size(); i++) { > System.out.println(consumer.position(listOfPartitions.get(i))); > } > > I have created a topic IssueTopic with 3 partitions with a single replica on my single node kafka installation (0.10.1.0) > The behavior noticed for Kafka client 0.10.1.0 as against Kafka client 0.10.0.1 > A) Initially when there are no messages on IssueTopic running the above program returns > 0.10.1.0 > 0 > 0 > 0 > 0.10.0.1 > 0 > 0 > 0 > B) Next I send 6 messages and see that the messages have been evenly distributed across the three partitions. Running the above program now returns > 0.10.1.0 > 0 > 0 > 2 > 0.10.0.1 > 2 > 2 > 2 > Clearly there is a difference in behavior for the 2 clients. > Now after seekToEnd call if I make a call to resume (uncomment the resume call in code above) then the behavior is > 0.10.1.0 > 2 > 2 > 2 > 0.10.0.1 > 2 > 2 > 2 > This is an issue I came across when using the spark kafka integration for 0.10. When I use kafka 0.10.1.0 I started seeing this issue. I had raised a pull request to resolve that issue [SPARK-18779] but when looking at the kafka client implementation/documentation now it seems the issue is with kafka and not with spark. There does not seem to be any documentation which specifies/implies that we need to call resume after seekToEnd for position to return the correct value. Also there is a clear difference in the behavior in the two kafka client implementations. -- This message was sent by Atlassian JIRA (v6.3.4#6332)