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 StreamThreadNotStartedException extends RetryableStateStoreException
public class StreamThreadRebalancingException extends RetryableStateStoreException
public class StateStoreMigratedException extends RetryableStateStoreException


# Fatal exceptionsInvalidStateStoreException
public class StreamThreadNotRunningException extends FatalStateStoreException
public class StateStoreNotAvailableException extends FatalStateStoreException


# Internal exceptions
InvalidStateStoreException
public class EmptyStateStoreExceptionUnknownStateStoreException extends InvalidStateStoreException
public class StateStoreClosedExceptionInvalidStateStorePartitionException extends InvalidStateStoreException

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.


  • 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: A wrapper for StateStoreClosedException / EmptyStateStoreException. Will will be thrown when state store already closed and stream thread state is RUNNING / REBALANCING.  The The user needs need to rediscover the state store.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: A wrapper for StateStoreClosedException / EmptyStateStoreException. Will be thrown when stream thread is PENDING_SHUTDOWN / NOT_RUNNING / ERROR. The
  • UnknownStateStoreException: will be thrown when passing an unknown state store. The user cannot retry when this exception is thrown.Internal exceptions
  • StateStoreClosedExceptionInvalidStateStorePartitionException: will be thrown when state store is not open. This is an internal exception and will be wrapped in StateStoreMigratedException or StateStoreNotAvailableException later.EmptyStateStoreException: will be thrown when state store cannot be found in all StateStoreProviders. This is an internal exception and will be wrapped in StateStoreMigratedException or StateStoreNotAvailableException lateruser requested partition is not available on the stream instance.


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

  • 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:

...

 

StreamsRebalancingExceptionStateStoreMigratedException, StateStoreNotAvailableException, InvalidStateStorePartitionException


Compatibility, Deprecation, and Migration Plan

...

G
M
T












Text-to-speech function is limited to 200 characters