-
Notifications
You must be signed in to change notification settings - Fork 135
Do not send "Create Topic req" when topic is already present #4402
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: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: matzew The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4402 +/- ##
==========================================
- Coverage 29.97% 29.97% -0.01%
==========================================
Files 290 290
Lines 19363 19372 +9
==========================================
+ Hits 5805 5806 +1
- Misses 13104 13112 +8
Partials 454 454 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
/retest-required |
/retest |
if statusConditionManager.IsTopicNotReady() { | ||
topic, err := kafka.CreateTopicIfDoesntExist(kafkaClusterAdminClient, logger, topicName, topicConfig) | ||
if err != nil { | ||
return "", statusConditionManager.FailedToCreateTopic(topic, err) | ||
} |
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.
note that conditions are reset on every reconciliation https://github.com/knative/pkg/blob/3c3a920206ea7ff7739c170f56746ea518f192f3/reconciler/reconcile_common.go#L63-L66
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.
I noticed a huge reduction of "create topic" requests, with this PR
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.
Maybe a way to work around this would be to update the CreateTopicIfDoesntExist
function to check if the topic exists before sending a create topic request?
As far as I can tell, the reason for so many requests is that the create topic method doesn't actually check if the topic exists before sending the request, so we could add that logic here:
eventing-kafka-broker/control-plane/pkg/kafka/topic.go
Lines 179 to 183 in db1e609
createTopicError := admin.CreateTopic(topic, &config.TopicDetail, false) | |
if err, ok := createTopicError.(*sarama.TopicError); ok && err.Err == sarama.ErrTopicAlreadyExists { | |
return topic, 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.
the list topics
would still send a request to kafka brokers
/retest |
/retest-required |
… avoid unneeded network calls (e.g. for Create Topic request) Signed-off-by: Matthias Wessendorf <[email protected]>
@matzew: The following tests failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Fixes #4406
Proposed Changes
IsTopicNotReady
Release Note
Docs