Table of Contents |
---|
Status
Current state: Under Discussion Discarded (in favor of KIP-892)
Discussion thread: here
JIRA: here
...
Code Block | ||||
---|---|---|---|---|
| ||||
/** * Return true the storage supports transactions. * * @return {@code true} if the storage supports transactions, {@code false} otherwise */ @Evolving default boolean transactional() { return false; } /** * Flush any cached data * */ @Deprecated default void flush() {} /** * Flush and commit any cached data * <p> * For transactional state store commit applies all changes atomically. In other words, either the * entire commit will be successful or none of the changes will be applied. * <p> * For non-transactional state store this method flushes cached data. * * @param changelogOffset the offset of the changelog topic this commit corresponds to. The * offset can be null if the state store does not have a changelog * (e.g. a global store). * @code null} */ @Evolving default void commit(final Long changelogOffset) { if (transactional()) { throw new UnsupportedOperationException("Transactional state store must implement StateStore#commit"); } else { flush(); } } /** * Recovers the state store after crash failure. * <p> * The state store recovers by discarding any writes that are not committed to the changelog * and rolling to the state that corresponds to {@code changelogOffset} or greater offset of * the changelog topic. * * @param changelogOffset the checkpointed changelog offset. * @return {@code true} if the state store recovered, {@code false} otherwise. */ @Evolving default boolean recover(final long changelogOffset) { if (transactional()) { throw new UnsupportedOperationException("Transactional state store must implement StateStore#recover"); } return false; } |
...
Proposed changes are source compatible and binary incompatible with previous releases.
Test Plan
- Add a variation for all existing stateful tests to run with enabled transactional state stores.
- Add tests to ensure that transactional state stores discard The state store discards uncommitted changes after crash failure.
- The state store replays Add tests to ensure that transactional state stores replay missing changes from the changelog topic on recovery.
Transactions via Secondary State Store for Uncommitted Changes
...