kafka: create and wait for topic during verification - #5898
Conversation
|
/test all |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Kafka sink now delegates topic verification and creation to ChangesKafka topic management
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Verify
participant EnsureTopic
participant ClusterAdminClient
Verify->>EnsureTopic: ensure topic with topic configuration
EnsureTopic->>ClusterAdminClient: create topic
ClusterAdminClient-->>EnsureTopic: return creation result
EnsureTopic->>ClusterAdminClient: check topic visibility
ClusterAdminClient-->>EnsureTopic: return topic metadata
EnsureTopic-->>Verify: return result
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@downstreamadapter/sink/topicmanager/kafka_topic_manager.go`:
- Around line 74-76: The topic manager must not report success from EnsureTopic
until the created topic is confirmed visible. Update the flow around
CreateTopicAndWaitUntilVisible in
downstreamadapter/sink/topicmanager/kafka_topic_manager.go:74-76 to return an
error when visibility is not achieved, including denied-create cases. In
downstreamadapter/sink/kafka/sink.go:126-129, preserve propagation of this
strict readiness error from EnsureTopic without converting it to success.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1c5431db-aad9-4356-98b0-a6f0f99011f1
📒 Files selected for processing (8)
downstreamadapter/sink/kafka/sink.godownstreamadapter/sink/topicmanager/kafka_topic_manager.godownstreamadapter/sink/topicmanager/kafka_topic_manager_test.gopkg/sink/kafka/admin.gopkg/sink/kafka/admin_test.gopkg/sink/kafka/cluster_admin_client.gopkg/sink/kafka/cluster_admin_client_mock.gopkg/sink/kafka/options_test.go
|
/test all |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lidezhu, wk989898 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
In response to a cherrypick label: new pull request created to branch |
What problem does this PR solve?
Issue Number: close #5896
What is changed and how it works?
When a Kafka consumer starts immediately after a changefeed is created, it can auto-create the topic with the broker defaults before TiCDC initializes the Kafka sink. Kafka sink verification previously sent a validate-only
CreateTopicsrequest, so the topic was not actually created. This can leave the topic with a partition count different from the changefeed configuration, causing message delivery failures and increasing replication lag.What is changed and how it works?
CreateTopicoperation always create the topic. The Sarama adapter now owns the fixedvalidateOnly=falseargument.Check List
Tests
Unit test
go test --tags=intest ./downstreamadapter/sink/topicmanager \ ./downstreamadapter/sink/kafka ./pkg/sink/kafka -count=1Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes