Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents

Status

Current state:  Under Discussion Accepted(vote)

Discussion thread: here

JIRA

Jira
serverASF JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyKAFKA-5876

...

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
languagejava
# Two category exceptions
public class RetryableStateStoreExceptionStreamsNotStartedException extends InvalidStateStoreException
public class FatalStateStoreExceptionStreamsRebalancingException extends InvalidStateStoreException


# Retryable exceptions
public class StreamsNotStartedException extends RetryableStateStoreException
public class StreamsRebalancingException extends RetryableStateStoreException
public class StateStoreMigratedException extends RetryableStateStoreException


# Fatal exceptionsInvalidStateStoreException
public class StreamsNotRunningExceptionStateStoreNotAvailableException extends FatalStateStoreExceptionInvalidStateStoreException
public class StateStoreNotAvailableExceptionUnknownStateStoreException extends FatalStateStoreExceptionInvalidStateStoreException
public class UnknownStateStoreExceptionInvalidStateStorePartitionException 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
  • Retryable exceptionsStreamsNotStartedException: will be thrown when streams stream thread state is CREATEDis CREATED, the user can retry until to RUNNING.
  • StreamsRebalancingException: will be thrown when streams 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 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.
  • Fatal exceptionsStateStoreNotAvailableException: will be thrown when state store closed and stream state is PENDING_SHUTDOWN / NOT_RUNNING / ERROR. The user cannot retry when this exception is thrown.
  • UnknownStateStoreException: will be thrown when passing an unknown state store. The user cannot retry when this exception is thrown.
  • InvalidStateStorePartitionException: will be thrown when user 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
Throw

All the above methods could be throw exceptions:

StreamsNotStartedException, StreamsRebalancingException,

StreamsNotRunningException

StateStoreMigratedException, StateStoreNotAvailableException,

 

UnknownStateStoreException, InvalidStateStorePartitionException


The following is the public methods that users will call to get store values:

...

Info

All the above methods could be throw following exceptions: 

StreamsRebalancingExceptionStateStoreMigratedException, StreamsNotRunningExceptionStateStoreNotAvailableExceptionStateStoreNotAvailableException,  InvalidStateStorePartitionException


Compatibility, Deprecation, and Migration Plan

...