You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by bb...@apache.org on 2026/09/24 16:38:11 UTC

(kafka) branch 4.3 updated: KAFKA-20416: Clear consumed offsets on task close (#23570)

This is an automated email from the ASF dual-hosted git repository.

bbejeck pushed a commit to branch 4.3
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/4.3 by this push:
     new 56e78f54817 KAFKA-20416: Clear consumed offsets on task close (#23570)
56e78f54817 is described below

commit 56e78f54817ce36a0276cc04f6005d23987b74d0
Author: Bill Bejeck <bb...@apache.org>
AuthorDate: Thu Sep 24 10:45:36 2026 -0400

    KAFKA-20416: Clear consumed offsets on task close (#23570)
    
    A corrupted EOS task is wiped and revived as the same `StreamTask`
    object, but `consumedOffsets` survived the close. For a `KTable` that
    uses its source topic as its changelog, the next checkpoint stamped
    those pre-corruption offsets onto the empty store. The store then looked
    fully restored, and the task ran with its `KTable` missing data.
    Clearing consumedOffsets in close() makes the wiped store restore from
    its actual position.
    
    The integration test in this PR fails without this fix.
    SourceTopicChangelogRestoreIntegrationTest was not included because
    it depends on KafkaProtocolFaultProxy, which is not on 4.3.
    
    Reviewers: Lucas Brutschy <lb...@confluent.io>
---
 .../java/org/apache/kafka/streams/processor/internals/StreamTask.java    | 1 +
 1 file changed, 1 insertion(+)

diff --git a/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java b/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java
index 7c593407008..6228cc37961 100644
--- a/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java
+++ b/streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java
@@ -710,6 +710,7 @@ public class StreamTask extends AbstractTask implements ProcessorNodePunctuator,
         record = null;
         closeTaskSensor.record();
         partitionsToResume.clear();
+        consumedOffsets.clear();
 
         transitionTo(State.CLOSED);
     }