Skip to content

KAFKA-20489: Add enable.transactional.statestores#22141

Open
nicktelford wants to merge 1 commit intoapache:trunkfrom
nicktelford:KIP-892/txn-config
Open

KAFKA-20489: Add enable.transactional.statestores#22141
nicktelford wants to merge 1 commit intoapache:trunkfrom
nicktelford:KIP-892/txn-config

Conversation

@nicktelford
Copy link
Copy Markdown
Contributor

@nicktelford nicktelford commented Apr 24, 2026

Introduces the enable.transactional.statestores config (default false). When enabled, uncommitted writes are held in an in-memory buffer per store and are not flushed to the underlying base store until the Kafka transaction commits, making staged writes invisible to IQ reads at the committed isolation level until the containing commit completes.

The config is threaded through TopologyConfig, TaskConfig, task creators, and ProcessorStateManager. When transactional stores are active, the EOS state wipe on unclean shutdown is suppressed: since uncommitted data never reaches the base store, there is nothing to wipe; corruption is handled explicitly via markChangelogAsCorrupted.

StreamTask.postCommit is extended to flush the pending write buffer on every commit interval, not only on task revocation or close. Under EOS the normal commit-interval path previously skipped maybeCheckpoint, the only path that calls stateMgr.commit() to flush each store's buffer. Without this, READ_COMMITTED IQ readers see no new data mid-run, and the uncommitted buffer grows unbounded between task lifecycle events.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Introduces the `enable.transactional.statestores` config (default
false). When enabled, uncommitted writes are held in an in-memory
buffer per store and are not flushed to the underlying base store
until the Kafka transaction commits, making staged writes invisible
to IQ reads at the committed isolation level until the containing
commit completes.

The config is threaded through TopologyConfig, TaskConfig, task
creators, and ProcessorStateManager. When transactional stores are
active, the EOS state wipe on unclean shutdown is suppressed: since
uncommitted data never reaches the base store, there is nothing to
wipe; corruption is handled explicitly via markChangelogAsCorrupted.

StreamTask.postCommit is extended to flush the pending write buffer
on every commit interval, not only on task revocation or close.
Under EOS the normal commit-interval path previously skipped
maybeCheckpoint, the only path that calls stateMgr.commit() to
flush each store's buffer. Without this, READ_COMMITTED IQ readers
see no new data mid-run, and the uncommitted buffer grows unbounded
between task lifecycle events.
@github-actions github-actions Bot added triage PRs from the community streams small Small PRs labels Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

small Small PRs streams triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant