DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
| Table of Contents |
|---|
Status
Current state: Under Voting Complete
Discussion thread: here
JIRA: here
...
Cross → Exception handling doesn't match as mentioned in KIP-691
Exception/Error Names | Current handling | New Handling | |||
|---|---|---|---|---|---|
Producer API | Transaction API | Producer API | Transaction API | Comments | |
CorruptRecordException NotEnoughReplicasAfterAppendException NotEnoughReplicasException TimeoutException | Retriable if the error is retriable. Otherwise abortable | Retriable if the error is retriable otherwise abortable | Producer Retriable | Producer Retriable | |
ConcurrentTransactionsException | Retriable | Retriable | Producer Retriable (KIP-890 may see this) | Producer Retriable | |
CoordinatorLoadInProgressException | Retriable | Retriable | Producer Retriable | Producer Retriable | |
Exception/Error Names | Current handling | New Handling | |||
|---|---|---|---|---|---|
Producer API | Transaction API | Producer API | Transaction API | Comments | |
UnknownTopicOrPartitionException NotLeaderOrFollowerException | Retriable if the error is retriable. Otherwise abortable | Retriable if the error is retriable otherwise abortable | Refresh + Retriable | Refresh + Retriable | Both UnknownTopicOrPartitionException and NotLeaderOrFollowerException extends InvalidMetadataException Current class hierarchy in code is: InvalidMetadataException < RetriableException < ApiException
InvalidMetadataException < < RetriableException < ApiException |
NotCoordinatorException CoordinatorNotAvailableException | Retriable | Retriable | Refresh + Retriable | Refresh + Retriable | |
TransactionAbortableException
Exception/Error Names | Current handling | New Handling | |||
|---|---|---|---|---|---|
Producer API | Transaction API | Producer API | Transaction API | Comments | |
TransactionAbortableException | Producer Abortable | Producer Abortable | Producer Abortable | Producer Abortable | |
ApplicationRecoverableException
Exception/Error Names | Current handling | New Handling | |||
|---|---|---|---|---|---|
Producer API | Transaction API | Producer API | Transaction API | Comments | |
IllegalStateException | Abortable |
Fatal
Sometimes Fatal depending on whether application or Sender caused issue. See: kafka: KAFKA-14831: Illegal state errors should be fatal in transactional producerCLOSED | Application Recoverable |
ProducerFencedException
Fatal
(probably not expected) | Application Recoverable |
Application Recoverable
InvalidPidMappingException
Sometimes retriable (no longer returned) or abortable
Abortable
Application Recoverable
Application Recoverable
FencedInstanceIdException
CommitFailedException
UnknownMemberIdException
IllegalGenerationExceiption
N/A
Abortable (TxnOffsetCommit Only)
N/A
Application Recoverable
CorrelationIdMismatchException
Application Recoverable
Application Recoverable
We will handle all default exceptions as generic unknown errors, which will be application recoverable. Below are few such exceptions:
Exception/Error Names
Current handling
New Handling
Producer API
Transaction API
Producer API
Transaction API
IllegalStateException
Abortable
Sometimes Fatal depending on whether application or Sender caused issue. See: kafka: KAFKA-14831: Illegal state errors should be fatal in transactional producerCLOSED
We will handle all default exceptions as generic unknown errors, which will be application recoverable | |||||
KafkaException | Abortable (default seems to be abortable) | Fatal in most cases, but abortable when there are partition errors | Application Recoverable (not expected) | Application Recoverable (not expected) | |
RuntimeException | Abortable (default seems to be abortable) | Fatal – only thrown as this generic type when correlation ID is wrong. This should be updated as KIP-691 suggests | Application Recoverable (not expected) | Application Recoverable (not expected) | |
InvalidProducerEpochException | Abortable | Fatal | Application Recoverable | Application Recoverable | |
ProducerFencedException | Fatal | Fatal | Application Recoverable |
Application Recoverable |
InvalidPidMappingException |
Abortable (default seems to be abortable)
Fatal in most cases, but abortable when there are partition errors
Sometimes retriable (no longer returned) or abortable | Abortable | Application Recoverable | Application Recoverable |
Exception/Error Names
Current handling
Expected Handling
Producer API
Transaction API
Producer API
Transaction API
| ||
FencedInstanceIdException CommitFailedException UnknownMemberIdException IllegalGenerationExceiption | N/A | Abortable ( |
Fatal – only thrown as this generic type when correlation ID is wrong. This should be updated as KIP-691 suggests
Application Recoverable (not expected)
Application Recoverable (not expected)
InvalidTxnStateException requires special handling where producer API and Transactional API has different handling:
TxnOffsetCommit Only) | N/A | Application Recoverable | CommitFailedException extends KafkaException, which is default exception handled as Application Recoverable. This class will not be extended by ApplicationRecoverableException | ||
CorrelationIdMismatchException | Application Recoverable | Application Recoverable | CorrelationIdMismatchException extends IllegalStateException, which is default exception handled as Application Recoverable. This class will not be extended by ApplicationRecoverableException |
InvalidTxnStateException | Abortable | Fatal | Producer Abortable (KIP-890 relies on this – note this is the only one that differs with Produce API) | Application Recoverable | InvalidTxnStateException requires special handling where producer API and Transactional API has different handling |
InvalidConfigurationException
Exception/Error Names | Current handling | Expected Handling | |||
|---|---|---|---|---|---|
Producer API | Transaction API | Producer API | Transaction API | Comments | |
AuthenticationException | Abortable | Fatal | Invalid Configuration | Invalid Configuration (not expected) | |
ClusterAuthorizationException TransactionalIdAuthorizationException UnsupportedVersionException UnsupportedForMessageFormatException | Fatal, except UnsupportedForMessageFormatException which is Abortable | Cluster/Transaction Auth → abortable on InitProducerId, other errors abortable TransactionAuth → fatal, others abortable for AddPartitions, Find Coordinator, EndTxn, AddOffsets Transaction Auth, UnssupportedForMessageFormat → fatal for OffsetCommit | Invalid Configuration | Invalid Configuration | |
InvalidRecordException InvalidRequiredAcksException RecordBatchTooLargeException InvalidTopicException | Retriable if the error is retriable. Otherwise abortable | Retriable if the error is retriable otherwise abortable | Invalid Configuration | Invalid Configuration | |
TopicAuthorizationException | |||||
GroupAuthorizationException
Abortable
Abortable
Invalid Configuration
Invalid Configuration
GroupAuthorizationException | Abortable | Abortable | Invalid Configuration | Invalid Configuration | Both TopicAuthorizationException and GroupAuthorizationException extends AuthorizationException Current class hierarchy in code is: TopicAuthorizationException < AuthorizationException < ApiException |
Public Interfaces
We have below exception classes available in current Kafka code
| Code Block |
|---|
// Producer Abortable Transaction public class TransactionAbortableException extends ApiException { ... } // Producer Abortable TransactionProducer Retriable public abstract class RetriableException extends ApiException { ... } // Invalid-Configuration public class TransactionAbortableExceptionInvalidConfigurationException extends ApiException { ... } //Producer Retriable ... } |
We will add new exception types, as listed in the table below, that extend the existing exceptions.
| Code Block |
|---|
//Producer Refresh and Retriable public abstract class RetriableExceptionRefreshRetriableException extends ApiExceptionRetriableException { ... } // Invalid-ConfigurationApplication-Recoverable new public abstract class InvalidConfigurationExceptionApplicationRecoverableException extends ApiException { ... } |
We will add new exception types, as listed in the table below, that extend the existing exceptions.extend below existing exceptions types to maintain class hierarchy
| Code Block |
|---|
//Producer RefreshUnknownTopicOrPartitionException and Retriable NotLeaderOrFollowerException extends InvalidMetadataException public abstract class RefreshRetriableExceptionInvalidMetadataException extends RetriableExceptionRefreshRetriableException { ... } //Application-Recoverable new public abstract TopicAuthorizationException and GroupAuthorizationException extends AuthorizationException public class ApplicationRecoverableExceptionAuthorizationException extends ApiExceptionInvalidConfigurationException { ... } |
Client side code example
...
Note: The producer.abortTransaction() method should will not throw an abortable exception to avoid creating a loop.
...
Currently, the transactional producer.send returns retriable exception types, such as TimeoutException , which poses a risk of duplicates in Kafka. In this KIP, we will update the transactional producer.send path such that all retriable exceptions will be translated to TransactionAbortableException in transaction producer code path. Older clients that are using the transactional producer and handling TimeoutException by retrying the produce operation can update to handle TransactionAbortableException .
...