-
Notifications
You must be signed in to change notification settings - Fork 61
kafka: use default option when meeting authorization and ACLs fails (#5562) #5591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release-nextgen-202603
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -618,12 +618,15 @@ func adjustOptions( | |||||||||||||||||||||||||
| TopicMaxMessageBytesConfigName, | ||||||||||||||||||||||||||
| BrokerMessageMaxBytesConfigName, | ||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||
| var topicMaxMessageBytes int | ||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||
| return errors.Trace(err) | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| topicMaxMessageBytes, err := strconv.Atoi(topicMaxMessageBytesStr) | ||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||
| return errors.Trace(err) | ||||||||||||||||||||||||||
| log.Warn("TiCDC cannot find `max.message.bytes` from topic's configuration, use the option `MaxMessageBytes` as default") | ||||||||||||||||||||||||||
| topicMaxMessageBytes = options.MaxMessageBytes | ||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||
| topicMaxMessageBytes, err = strconv.Atoi(topicMaxMessageBytesStr) | ||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||
| return errors.Trace(err) | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| maxMessageBytes := topicMaxMessageBytes - maxMessageBytesOverhead | ||||||||||||||||||||||||||
|
|
@@ -654,14 +657,16 @@ func adjustOptions( | |||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| var brokerMessageMaxBytes int | ||||||||||||||||||||||||||
| brokerMessageMaxBytesStr, err := admin.GetBrokerConfig(BrokerMessageMaxBytesConfigName) | ||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||
| log.Warn("TiCDC cannot find `message.max.bytes` from broker's configuration") | ||||||||||||||||||||||||||
| return errors.Trace(err) | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| brokerMessageMaxBytes, err := strconv.Atoi(brokerMessageMaxBytesStr) | ||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||
| return errors.Trace(err) | ||||||||||||||||||||||||||
| log.Warn("TiCDC cannot find `message.max.bytes` from broker's configuration, use the option `MaxMessageBytes` as default") | ||||||||||||||||||||||||||
| brokerMessageMaxBytes = options.MaxMessageBytes | ||||||||||||||||||||||||||
|
Comment on lines
662
to
+664
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When falling back to the default
Suggested change
|
||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||
| brokerMessageMaxBytes, err = strconv.Atoi(brokerMessageMaxBytesStr) | ||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||
| return errors.Trace(err) | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| // when create the topic, `max.message.bytes` is decided by the broker, | ||||||||||||||||||||||||||
|
|
@@ -728,9 +733,9 @@ func validateMinInsyncReplicas( | |||||||||||||||||||||||||
| "to the minimum number of in-sync replicas" + | ||||||||||||||||||||||||||
| "if you want to use `required-acks` = -1." + | ||||||||||||||||||||||||||
| "Otherwise, TiCDC will not be able to send messages to the topic.") | ||||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| return err | ||||||||||||||||||||||||||
| log.Warn("TiCDC meets error when get `min.insync.replicas` from broker's configuration, assume the config is valid") | ||||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||
|
Comment on lines
+737
to
+738
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When ignoring the error while fetching
Suggested change
|
||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| minInsyncReplicas, err := strconv.Atoi(minInsyncReplicasStr) | ||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When falling back to the default
MaxMessageBytesdue to an error fetching the topic configuration, it is important to log the actual errorerr. This helps operators diagnose whether the failure was due to an authorization/ACL issue, a network timeout, or another problem.