Skip to content

Commit

Permalink
kerr: ReplicaNotAvailable is retriable; add UnknownTopicID
Browse files Browse the repository at this point in the history
ReplicaNotAvailable extends InvalidMetadataException, which itself
extends RetriableException
  • Loading branch information
twmb committed Jan 31, 2021
1 parent a2ffc65 commit b50282e
Showing 1 changed file with 104 additions and 102 deletions.
206 changes: 104 additions & 102 deletions pkg/kerr/kerr.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var (
NotLeaderForPartition = &Error{"NOT_LEADER_FOR_PARTITION", 6, true, "This server is not the leader for that topic-partition."}
RequestTimedOut = &Error{"REQUEST_TIMED_OUT", 7, true, "The request timed out."}
BrokerNotAvailable = &Error{"BROKER_NOT_AVAILABLE", 8, false, "The broker is not available."}
ReplicaNotAvailable = &Error{"REPLICA_NOT_AVAILABLE", 9, false, "The replica is not available for the requested topic-partition."}
ReplicaNotAvailable = &Error{"REPLICA_NOT_AVAILABLE", 9, true, "The replica is not available for the requested topic-partition."}
MessageTooLarge = &Error{"MESSAGE_TOO_LARGE", 10, false, "The request included a message larger than the max message size the server will accept."}
StaleControllerEpoch = &Error{"STALE_CONTROLLER_EPOCH", 11, false, "The controller moved to another broker."}
OffsetMetadataTooLarge = &Error{"OFFSET_METADATA_TOO_LARGE", 12, false, "The metadata field of the offset request was too large."}
Expand Down Expand Up @@ -145,108 +145,110 @@ var (
PrincipalDeserializationFailure = &Error{"PRINCIPAL_DESERIALIZATION_FAILURE", 97, false, "Request principal deserialization failed during forwarding. This indicates an internal error on the broker cluster security setup."}
SnapshotNotFound = &Error{"SNAPSHOT_NOT_FOUND", 98, false, "Requested snapshot was not found."}
PositionOutOfRange = &Error{"POSITION_OUT_OF_RANGE", 99, false, "Requested position is not greater than or equal to zero, and less than the size of the snapshot."}
UnknownTopicID = &Error{"UNKNOWN_TOPIC_ID", 100, true, "This server does not host this topic ID."}
)

var code2err = map[int16]error{
-1: UnknownServerError,
0: nil,
1: OffsetOutOfRange,
2: CorruptMessage,
3: UnknownTopicOrPartition,
4: InvalidFetchSize,
5: LeaderNotAvailable,
6: NotLeaderForPartition,
7: RequestTimedOut,
8: BrokerNotAvailable,
9: ReplicaNotAvailable,
10: MessageTooLarge,
11: StaleControllerEpoch,
12: OffsetMetadataTooLarge,
13: NetworkException,
14: CoordinatorLoadInProgress,
15: CoordinatorNotAvailable,
16: NotCoordinator,
17: InvalidTopicException,
18: RecordListTooLarge,
19: NotEnoughReplicas,
20: NotEnoughReplicasAfterAppend,
21: InvalidRequiredAcks,
22: IllegalGeneration,
23: InconsistentGroupProtocol,
24: InvalidGroupID,
25: UnknownMemberID,
26: InvalidSessionTimeout,
27: RebalanceInProgress,
28: InvalidCommitOffsetSize,
29: TopicAuthorizationFailed,
30: GroupAuthorizationFailed,
31: ClusterAuthorizationFailed,
32: InvalidTimestamp,
33: UnsupportedSaslMechanism,
34: IllegalSaslState,
35: UnsupportedVersion,
36: TopicAlreadyExists,
37: InvalidPartitions,
38: InvalidReplicationFactor,
39: InvalidReplicaAssignment,
40: InvalidConfig,
41: NotController,
42: InvalidRequest,
43: UnsupportedForMessageFormat,
44: PolicyViolation,
45: OutOfOrderSequenceNumber,
46: DuplicateSequenceNumber,
47: InvalidProducerEpoch,
48: InvalidTxnState,
49: InvalidProducerIDMapping,
50: InvalidTransactionTimeout,
51: ConcurrentTransactions,
52: TransactionCoordinatorFenced,
53: TransactionalIDAuthorizationFailed,
54: SecurityDisabled,
55: OperationNotAttempted,
56: KafkaStorageError,
57: LogDirNotFound,
58: SaslAuthenticationFailed,
59: UnknownProducerID,
60: ReassignmentInProgress,
61: DelegationTokenAuthDisabled,
62: DelegationTokenNotFound,
63: DelegationTokenOwnerMismatch,
64: DelegationTokenRequestNotAllowed,
65: DelegationTokenAuthorizationFailed,
66: DelegationTokenExpired,
67: InvalidPrincipalType,
68: NonEmptyGroup,
69: GroupIDNotFound,
70: FetchSessionIDNotFound,
71: InvalidFetchSessionEpoch,
72: ListenerNotFound,
73: TopicDeletionDisabled,
74: FencedLeaderEpoch,
75: UnknownLeaderEpoch,
76: UnsupportedCompressionType,
77: StaleBrokerEpoch,
78: OffsetNotAvailable,
79: MemberIDRequired,
80: PreferredLeaderNotAvailable,
81: GroupMaxSizeReached,
82: FencedInstanceID,
83: EligibleLeadersNotAvailable,
84: ElectionNotNeeded,
85: NoReassignmentInProgress,
86: GroupSubscribedToTopic,
87: InvalidRecord,
88: UnstableOffsetCommit,
89: ThrottlingQuotaExceeded,
90: ProducerFenced,
91: ResourceNotFound,
92: DuplicateResource,
93: UnacceptableCredential,
94: InconsistentVoterSet,
95: InvalidUpdateVersion,
96: FeatureUpdateFailed,
97: PrincipalDeserializationFailure,
98: SnapshotNotFound,
99: PositionOutOfRange,
-1: UnknownServerError,
0: nil,
1: OffsetOutOfRange,
2: CorruptMessage,
3: UnknownTopicOrPartition,
4: InvalidFetchSize,
5: LeaderNotAvailable,
6: NotLeaderForPartition,
7: RequestTimedOut,
8: BrokerNotAvailable,
9: ReplicaNotAvailable,
10: MessageTooLarge,
11: StaleControllerEpoch,
12: OffsetMetadataTooLarge,
13: NetworkException,
14: CoordinatorLoadInProgress,
15: CoordinatorNotAvailable,
16: NotCoordinator,
17: InvalidTopicException,
18: RecordListTooLarge,
19: NotEnoughReplicas,
20: NotEnoughReplicasAfterAppend,
21: InvalidRequiredAcks,
22: IllegalGeneration,
23: InconsistentGroupProtocol,
24: InvalidGroupID,
25: UnknownMemberID,
26: InvalidSessionTimeout,
27: RebalanceInProgress,
28: InvalidCommitOffsetSize,
29: TopicAuthorizationFailed,
30: GroupAuthorizationFailed,
31: ClusterAuthorizationFailed,
32: InvalidTimestamp,
33: UnsupportedSaslMechanism,
34: IllegalSaslState,
35: UnsupportedVersion,
36: TopicAlreadyExists,
37: InvalidPartitions,
38: InvalidReplicationFactor,
39: InvalidReplicaAssignment,
40: InvalidConfig,
41: NotController,
42: InvalidRequest,
43: UnsupportedForMessageFormat,
44: PolicyViolation,
45: OutOfOrderSequenceNumber,
46: DuplicateSequenceNumber,
47: InvalidProducerEpoch,
48: InvalidTxnState,
49: InvalidProducerIDMapping,
50: InvalidTransactionTimeout,
51: ConcurrentTransactions,
52: TransactionCoordinatorFenced,
53: TransactionalIDAuthorizationFailed,
54: SecurityDisabled,
55: OperationNotAttempted,
56: KafkaStorageError,
57: LogDirNotFound,
58: SaslAuthenticationFailed,
59: UnknownProducerID,
60: ReassignmentInProgress,
61: DelegationTokenAuthDisabled,
62: DelegationTokenNotFound,
63: DelegationTokenOwnerMismatch,
64: DelegationTokenRequestNotAllowed,
65: DelegationTokenAuthorizationFailed,
66: DelegationTokenExpired,
67: InvalidPrincipalType,
68: NonEmptyGroup,
69: GroupIDNotFound,
70: FetchSessionIDNotFound,
71: InvalidFetchSessionEpoch,
72: ListenerNotFound,
73: TopicDeletionDisabled,
74: FencedLeaderEpoch,
75: UnknownLeaderEpoch,
76: UnsupportedCompressionType,
77: StaleBrokerEpoch,
78: OffsetNotAvailable,
79: MemberIDRequired,
80: PreferredLeaderNotAvailable,
81: GroupMaxSizeReached,
82: FencedInstanceID,
83: EligibleLeadersNotAvailable,
84: ElectionNotNeeded,
85: NoReassignmentInProgress,
86: GroupSubscribedToTopic,
87: InvalidRecord,
88: UnstableOffsetCommit,
89: ThrottlingQuotaExceeded,
90: ProducerFenced,
91: ResourceNotFound,
92: DuplicateResource,
93: UnacceptableCredential,
94: InconsistentVoterSet,
95: InvalidUpdateVersion,
96: FeatureUpdateFailed,
97: PrincipalDeserializationFailure,
98: SnapshotNotFound,
99: PositionOutOfRange,
100: UnknownTopicID,
}

0 comments on commit b50282e

Please sign in to comment.