...
Table of Contents |
---|
Status
Current state: Under Discussion Accepted(vote)
Discussion thread: here
JIRA:
Jira | ||||||||
---|---|---|---|---|---|---|---|---|
|
...
To distinguish different types of error, we need to handle all InvalidStateStoreExceptions better during these public methods invoked. The main change is to introduce new exceptions that extend from InvalidStateStoreException. InvalidStateStoreException is not thrown at all anymore, but only new sub-classes.
Code Block | ||
---|---|---|
| ||
# Two category exceptions public class RetryableStateStoreExceptionStreamsNotStartedException extends InvalidStateStoreException public class FatalStateStoreExceptionStreamsRebalancingException extends InvalidStateStoreException # Retryable exceptions public class StreamThreadNotStartedExceptionStateStoreMigratedException extends RetryableStateStoreExceptionInvalidStateStoreException public class StreamThreadRebalancingExceptionStateStoreNotAvailableException extends RetryableStateStoreExceptionInvalidStateStoreException public class StateStoreMigratedExceptionUnknownStateStoreException extends RetryableStateStoreException # Fatal exceptions InvalidStateStoreException public class StreamThreadNotRunningExceptionInvalidStateStorePartitionException extends FatalStateStoreException |
Various state store exceptions can classify into two category exceptions: RetryableStateStoreException and FatalStateStoreException. The user can use the two exceptions if they only need to distinguish whether it can retry.
InvalidStateStoreException
|
- StreamsNRetryable exceptionsStreamThreadNotStartedException: will be thrown when streams stream thread state is CREATEDis CREATED, the user can retry until to RUNNING.
- StreamThreadRebalancingExceptionStreamsRebalancingException: will be thrown when stream thread is not running and stream state is REBALANCINGis REBALANCING, the user just retry and wait until rebalance finished (RUNNING).
- StateStoreMigratedException: will be thrown when state store already closed or state store cannot be found.and stream state is RUNNING. The user need to rediscover the store and cannot blindly retry as the store handle is invalid and a new store handle must be retrived.
- StateStoreNotAvailableExceptionFatal exceptionsStreamThreadNotRunningException: will be thrown when stream thread is not running state store closed and stream state is PENDINGis PENDING_SHUTDOWN / NOT NOT_RUNNING / ERROR. The user cannot retry when this exception is thrown.StateStoreNotAvailableException
- UnknownStateStoreException: will be thrown when stream thread is PENDING_SHUTDOWN / NOT_RUNNING / ERROR. The passing an unknown state store. The user cannot retry when this exception is thrown.UnknownStateStoreException
- InvalidStateStorePartitionException: will be thrown when passing an unknown state storeuser requested partition is not available on the stream instance.
The following is the public methods that users will call to get state store instance:
- KafkaStreams
- @Deprecated store(storeName, queryableStoreType)
...
- store(storeQureyParams)
Info |
---|
All the above methods could be throw |
...
exceptions: |
...
StreamsNotStartedException, StreamsRebalancingException, StateStoreMigratedException, |
...
StateStoreNotAvailableException, |
...
UnknownStateStoreException, |
...
InvalidStateStorePartitionException |
The following is the public methods that users will call to get store values:
- interface ReadOnlyKeyValueStore(class CompositeReadOnlyKeyValueStore)
- get(key)
- range(from, to)
- all()
- approximateNumEntries()
- interface ReadOnlySessionStore(class CompositeReadOnlySessionStore)
- fetch(key)
- fetch(from, to)
- interface ReadOnlyWindowStore(class CompositeReadOnlyWindowStore)
- fetch(key, time)
fetch(key, from, to)
- fetch(from, to, fromTime, toTime)
- all()
- fetchAll(from, to)
- @Deprecated fetch(key, timeFrom, timeTo)
- @Deprecated fetch(from, to, timeFrom, timeTo)
- @Deprecated fetchAll(timeFrom, timeTo)
- interface KeyValueIterator(class DelegatingPeekingKeyValueIterator)
- next()
- hasNext()
- peekNextKey()
Info |
---|
All the above methods could be throw following exceptions: |
...
StreamsRebalancingException, StateStoreMigratedException, |
...
StateStoreNotAvailableException, |
...
InvalidStateStorePartitionException |
Compatibility, Deprecation, and Migration Plan
...