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 5BC12200D48 for ; Tue, 14 Nov 2017 21:34:04 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 5A1D2160BD7; Tue, 14 Nov 2017 20:34:04 +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 A0502160BF4 for ; Tue, 14 Nov 2017 21:34:03 +0100 (CET) Received: (qmail 66844 invoked by uid 500); 14 Nov 2017 20:34:02 -0000 Mailing-List: contact jira-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jira@kafka.apache.org Delivered-To: mailing list jira@kafka.apache.org Received: (qmail 66781 invoked by uid 99); 14 Nov 2017 20:34:02 -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, 14 Nov 2017 20:34:02 +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 F2999C89FB for ; Tue, 14 Nov 2017 20:34:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.201 X-Spam-Level: X-Spam-Status: No, score=-99.201 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] 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 MRhJfjseBaTB for ; Tue, 14 Nov 2017 20:34:01 +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 D31475FD92 for ; Tue, 14 Nov 2017 20:34:00 +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 557AAE00C9 for ; Tue, 14 Nov 2017 20:34:00 +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 13A98240D2 for ; Tue, 14 Nov 2017 20:34:00 +0000 (UTC) Date: Tue, 14 Nov 2017 20:34:00 +0000 (UTC) From: "Fabien Chaillou (JIRA)" To: jira@kafka.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (KAFKA-6209) Lag is inconsistent when manually committing offset for transactionnal messages MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 14 Nov 2017 20:34:04 -0000 [ https://issues.apache.org/jira/browse/KAFKA-6209?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabien Chaillou updated KAFKA-6209: ----------------------------------- Description: Hi, I'm using kafka consumers paired with kafka producers to have transactionnal consume -> produce -> commit flow. I checked the kafka-consumer-groups.sh tool to make sure my consumer were consuming all the messages and it appears that my consumer always have a lag of 1. After more digging, I discovered that kafka uses Control records for transaction handling and those records are not returned to the consumer. So if the last record published in the topic is part of a transaction then kafka will add a control record after it and the client code will only be able to send a commit request up to the last control record and the lag will be computed as 1. It is not really a bug per se but an inconsistent behavior and I had to dig into the exactly-once KIP (KIP-98) and the consumer code to figure this out. I think the issue should at least be documented somewhere as I'm honestly not sure of the proper fix. Thanks for your feedback. Fabien was: Hi, I'm using kafka consumers paired with kafka producers to have transactionnal consume -> produce -> commit flow. I checked the kafka-consumer-groups.sh tool to make sure my consumer were consuming all the messages and it appears that my consumer always have a lag of 1. After more digging, I discovered that kafka uses Control records for transaction handling and those records are not returned to the consumer. So if the last record published in the topic is part of a transaction then kafka will add a control record after it and the client code will only be able to send a commit request up to the last control record and the lag will be computed as 1. It is not really a bug per se but an inconsistent behavior and I add to dig into the exactly-once KIP (KIP-98) and the consumer code to figure this out. I think the issue should at least be documented somewhere as I'm honestly not sure of the proper fix. Thanks for your feedback. Fabien > Lag is inconsistent when manually committing offset for transactionnal messages > ------------------------------------------------------------------------------- > > Key: KAFKA-6209 > URL: https://issues.apache.org/jira/browse/KAFKA-6209 > Project: Kafka > Issue Type: Improvement > Components: consumer > Affects Versions: 0.11.0.1 > Reporter: Fabien Chaillou > > Hi, > I'm using kafka consumers paired with kafka producers to have transactionnal consume -> produce -> commit flow. > I checked the kafka-consumer-groups.sh tool to make sure my consumer were consuming all the messages and it appears that my consumer always have a lag of 1. > After more digging, I discovered that kafka uses Control records for transaction handling and those records are not returned to the consumer. So if the last record published in the topic is part of a transaction then kafka will add a control record after it and the client code will only be able to send a commit request up to the last control record and the lag will be computed as 1. > It is not really a bug per se but an inconsistent behavior and I had to dig into the exactly-once KIP (KIP-98) and the consumer code to figure this out. > I think the issue should at least be documented somewhere as I'm honestly not sure of the proper fix. > Thanks for your feedback. > Fabien -- This message was sent by Atlassian JIRA (v6.4.14#64029)