You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Peter Romianowski (JIRA)" <ji...@apache.org> on 2012/05/18 16:57:07 UTC

[jira] [Created] (KAFKA-346) Don't call commitOffsets() during rebalance

Peter Romianowski created KAFKA-346:
---------------------------------------

             Summary: Don't call commitOffsets() during rebalance
                 Key: KAFKA-346
                 URL: https://issues.apache.org/jira/browse/KAFKA-346
             Project: Kafka
          Issue Type: Improvement
          Components: core
    Affects Versions: 0.7, 0.8, 0.7.1
            Reporter: Peter Romianowski


A sample use-case

If I read the source correctly then offsets can be committed at any
time (whenever there is a change in consumer or broker zk registry).
Our application doesn't use auto-commit in order to batch some
messages together, process them and if everything went fine, we call
commitOffsets(). If, for any reason, the processing of messages does
not succeed, we rely on Kafka's promise to re-deliver the messages.

But if ZKRebalancerListener triggers a rebalance before our "batch" of
messages is full, then offsets will be committed even if the messages
have not been processed yet by our application. So if then processing
of these messages fails, we basically lost them, right?

(See discussion at http://www.mail-archive.com/kafka-users@incubator.apache.org/msg01415.html)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (KAFKA-346) Don't call commitOffsets() during rebalance

Posted by "Peter Romianowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KAFKA-346?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Romianowski updated KAFKA-346:
------------------------------------

    Attachment: KAFKA-346.patch

Added a patch against trunk. In order to compile KAFKA-345 has to be applied.
                
> Don't call commitOffsets() during rebalance
> -------------------------------------------
>
>                 Key: KAFKA-346
>                 URL: https://issues.apache.org/jira/browse/KAFKA-346
>             Project: Kafka
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 0.7, 0.8, 0.7.1
>            Reporter: Peter Romianowski
>         Attachments: KAFKA-346.patch
>
>
> A sample use-case
> If I read the source correctly then offsets can be committed at any
> time (whenever there is a change in consumer or broker zk registry).
> Our application doesn't use auto-commit in order to batch some
> messages together, process them and if everything went fine, we call
> commitOffsets(). If, for any reason, the processing of messages does
> not succeed, we rely on Kafka's promise to re-deliver the messages.
> But if ZKRebalancerListener triggers a rebalance before our "batch" of
> messages is full, then offsets will be committed even if the messages
> have not been processed yet by our application. So if then processing
> of these messages fails, we basically lost them, right?
> (See discussion at http://www.mail-archive.com/kafka-users@incubator.apache.org/msg01415.html)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (KAFKA-346) Don't call commitOffsets() during rebalance

Posted by "Peter Romianowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KAFKA-346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13278850#comment-13278850 ] 

Peter Romianowski commented on KAFKA-346:
-----------------------------------------

I could now write a patch that - as Jun suggested - does not commit offsets, if autoCommit has been turned off. Together with KAFKA-345 that adds a listener for rebalance-events, we could simply use a listener and throw away all messages in our batch upon a rebalance. That would work fine for us.

My question is: Do you think this is the behavior others would expect? Even though the current behavior is broken IMHO, the new one would introduce quite some duplicate messages which have to be handled by the application.

Are there better ideas on how to fix this?
                
> Don't call commitOffsets() during rebalance
> -------------------------------------------
>
>                 Key: KAFKA-346
>                 URL: https://issues.apache.org/jira/browse/KAFKA-346
>             Project: Kafka
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 0.7, 0.8, 0.7.1
>            Reporter: Peter Romianowski
>
> A sample use-case
> If I read the source correctly then offsets can be committed at any
> time (whenever there is a change in consumer or broker zk registry).
> Our application doesn't use auto-commit in order to batch some
> messages together, process them and if everything went fine, we call
> commitOffsets(). If, for any reason, the processing of messages does
> not succeed, we rely on Kafka's promise to re-deliver the messages.
> But if ZKRebalancerListener triggers a rebalance before our "batch" of
> messages is full, then offsets will be committed even if the messages
> have not been processed yet by our application. So if then processing
> of these messages fails, we basically lost them, right?
> (See discussion at http://www.mail-archive.com/kafka-users@incubator.apache.org/msg01415.html)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (KAFKA-346) Don't call commitOffsets() during rebalance

Posted by "Jay Kreps (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/KAFKA-346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13278976#comment-13278976 ] 

Jay Kreps commented on KAFKA-346:
---------------------------------

Personally I think this makes sense. If you set auto-commit we commit for you. If you say no to auto-commit you handle commits.
                
> Don't call commitOffsets() during rebalance
> -------------------------------------------
>
>                 Key: KAFKA-346
>                 URL: https://issues.apache.org/jira/browse/KAFKA-346
>             Project: Kafka
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 0.7, 0.8, 0.7.1
>            Reporter: Peter Romianowski
>
> A sample use-case
> If I read the source correctly then offsets can be committed at any
> time (whenever there is a change in consumer or broker zk registry).
> Our application doesn't use auto-commit in order to batch some
> messages together, process them and if everything went fine, we call
> commitOffsets(). If, for any reason, the processing of messages does
> not succeed, we rely on Kafka's promise to re-deliver the messages.
> But if ZKRebalancerListener triggers a rebalance before our "batch" of
> messages is full, then offsets will be committed even if the messages
> have not been processed yet by our application. So if then processing
> of these messages fails, we basically lost them, right?
> (See discussion at http://www.mail-archive.com/kafka-users@incubator.apache.org/msg01415.html)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (KAFKA-346) Don't call commitOffsets() during rebalance

Posted by "Peter Romianowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/KAFKA-346?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Romianowski updated KAFKA-346:
------------------------------------

    Status: Patch Available  (was: Open)
    
> Don't call commitOffsets() during rebalance
> -------------------------------------------
>
>                 Key: KAFKA-346
>                 URL: https://issues.apache.org/jira/browse/KAFKA-346
>             Project: Kafka
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 0.7, 0.8, 0.7.1
>            Reporter: Peter Romianowski
>         Attachments: KAFKA-346.patch
>
>
> A sample use-case
> If I read the source correctly then offsets can be committed at any
> time (whenever there is a change in consumer or broker zk registry).
> Our application doesn't use auto-commit in order to batch some
> messages together, process them and if everything went fine, we call
> commitOffsets(). If, for any reason, the processing of messages does
> not succeed, we rely on Kafka's promise to re-deliver the messages.
> But if ZKRebalancerListener triggers a rebalance before our "batch" of
> messages is full, then offsets will be committed even if the messages
> have not been processed yet by our application. So if then processing
> of these messages fails, we basically lost them, right?
> (See discussion at http://www.mail-archive.com/kafka-users@incubator.apache.org/msg01415.html)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira