A stateful topology stores more than its last output. It needs aggregate state and progress so a restart can continue without counting all old input again. Kafka Streams uses local state stores, changelog topics and recovery mechanisms; this model keeps a deterministic state store and processed offsets in the cluster snapshot. Running the same topology again should not emit another result for records it already processed. These tasks add one new event to an existing aggregate and run twice. Preserve the store instead of recreating the topology from scratch. Inspect the new count and output count together. A plausible total can still hide duplicate emissions to downstream consumers.
Inspect the topics, partition logs and group offsets before changing the cluster.