KAFKA-17411: Add new StateStore interfaces #20955
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These are the new interfaces detailed in KIP-1035: "StateStore managed
changelog offsets".
This PR introduces the interfaces changes, but makes otherwise no
consequential behavioural changes.
Outside of
StateStore.java, all changes are essentially just arename of all invocations of
StateStore#flushto instead callStateStore#commit.The
changelogOffsetsbeing passed in these invocations is currentlyunused: the behaviour of
StateStore#commitremains identical toStateStore#flushbefore these changes.A new implementation of
StateStore#committhat actually uses theseoffsets, along with changes to the use-site (in
ProcessorStateManagerand
GlobalStateManager) will come in a later PR.Many strings, including documentation, and some variable names, have
also been renamed (from "flush" to "commit"), to maintain consistency
with the method they relate to.
One exception is the
flush-ratemetric, which has not been renamed,because it will instead be deprecated in favour of a new
commit-ratemetric, which will be introduced in another PR.
The only change in behaviour is as follows: calling
StateStore#flushfrom within a
Processoris now a guaranteed no-op.In the future, this will throw an
UnsupportedOperationException, butto ensure no changes to end-user experience, we currently make it a
no-op.
Previously, any call to
StateStore#flushfrom aProcessorwould havemade no difference to program semantics, but likely would introduce
performance problems for RocksDB. This is because it would force a flush
of RocksDB memtables to disk on every invocation, which if naively used
could be on every
Record.Consequently, making this a no-op should not make a difference for
end-users, except potentially improving performance if they were
incorrectly calling this method.