KAFKA-14711: 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 a rename of all invocations ofStateStore#flushto instead callStateStore#commit.The
changelogOffsetsbeing passed in these invocations is currently unused: the behaviour ofStateStore#commitremains identical toStateStore#flushbefore these changes.A new implementation of
StateStore#committhat actually uses these offsets, along with changes to the use-site (inProcessorStateManagerandGlobalStateManager) 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 newcommit-ratemetric, which will be introduced in another PR.The only change in behaviour is as follows: calling
StateStore#flushfrom within aProcessoris now a guaranteed no-op.In the future, this will throw an
UnsupportedOperationException, but to ensure no changes to end-user experience, we currently make it a no-op.Previously, any call to
StateStore#flushfrom aProcessorwould have made 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 everyRecord.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.