ableegoldman commented on a change in pull request #8900:
URL: https://github.com/apache/kafka/pull/8900#discussion_r442619459



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java
##########
@@ -522,7 +522,7 @@ private void close(final boolean clean) {
         if (clean && commitNeeded) {
             log.debug("Tried to close clean but there was pending uncommitted 
data, this means we failed to"
                           + " commit and should close as dirty instead");
-            throw new StreamsException("Tried to close dirty task as clean");

Review comment:
       This was a sort-of bug: because we don't close things during 
`handleRevocation`, we want to make sure the TM will close this as dirty during 
`handleAssignment`. So we throw this just to force it to call `closeDirty` -- 
but it wasn't necessarily a fatal exception that caused commit to fail, so we 
should just throw TaskMigrated here.
   That said, it doesn't really matter since the ConsumerCoordinator will save 
and rethrow only the first exception, which is the `handleRevocation` 
exception. Anything we throw in `handleAssignment` is "lost" -- but we should 
do the right thing anyway




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to