[ 
https://issues.apache.org/jira/browse/KAFKA-4561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15764971#comment-15764971
 ] 

ASF GitHub Bot commented on KAFKA-4561:
---------------------------------------

GitHub user dguy opened a pull request:

    https://github.com/apache/kafka/pull/2281

    KAFKA-4561: Ordering of operations in StreamThread.shutdownTasksAndState 
may void at-least-once guarantees

    In `shutdownTasksAndState` and `suspendTasksAndState` we commit offsets 
BEFORE we flush any state. This is wrong as if an exception occurs during a 
flush, we may violate the at-least-once guarantees, that is we would have 
committed some offsets but NOT sent the processed data on to other Sinks.
    Also during suspend and shutdown, we should try and complete all tasks even 
when exceptions occur. We should just keep track of the exception and rethrow 
it at the end if necessary. This helps with ensuring that StateStores etc are 
closed.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dguy/kafka kafka-4561

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/2281.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 #2281
    
----
commit e60f0d020d837f6c10406bdecd92d77a3b6c089b
Author: Damian Guy <damian....@gmail.com>
Date:   2016-12-20T18:59:14Z

    change ordering of suspend and shutdown in StreamThread so that we dont 
lose data. Always try and run all the steps even if there are exceptions

----


> Ordering of operations in StreamThread.shutdownTasksAndState may void 
> at-least-once guarantees
> ----------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-4561
>                 URL: https://issues.apache.org/jira/browse/KAFKA-4561
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>    Affects Versions: 0.10.2.0
>            Reporter: Damian Guy
>            Assignee: Damian Guy
>             Fix For: 0.10.2.0
>
>
> In {{shutdownTasksAndState}} we currently commit offsets as the first step. 
> If a subsequent step throws an exception, i.e, flushing the producer, then 
> this would violate the at-least-once guarantees.
> We need to commit after all other state has been flushed



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to