Skip to content

kafka: add server debug switch for franz-go and enable it in CI (#6567) - #6664

Open
ti-chi-bot wants to merge 4 commits into
pingcap:release-nextgen-202609from
ti-chi-bot:cherry-pick-6567-to-release-nextgen-202609
Open

ti-chi-bot wants to merge 4 commits into
pingcap:release-nextgen-202609from
ti-chi-bot:cherry-pick-6567-to-release-nextgen-202609

Conversation

@ti-chi-bot

@ti-chi-bot ti-chi-bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

This is an automated cherry-pick of #6567

What problem does this PR solve?

Issue Number: close #6566

What is changed and how it works?

  • Add the temporary [debug] enable-kafka-franz-go server option, disabled by default. Explicit kafka-client URI settings take precedence.
  • Add a shared integration-test cdc_server.toml that enables franz-go. The launcher uses this file by default, and an explicit --config selects the case-specific file.
  • Enable franz-go explicitly in the existing Kafka authentication case configs.
  • Cover configuration decoding and cloning and client selection precedence with unit tests.
  • Remove the mistakenly committed root server.toml.

Check List

Tests

  • Unit test:
    • make unit_test_pkg PKG='./pkg/config ./pkg/sink/kafka' P=2 — 407 tests passed with race detection.
  • Manual test:
    • make cdc — passed.
    • Eight startup configuration smoke checks with a stub CDC binary and TOML decoding — passed, covering the shared default file, explicit configs, redaction, legacy safepoint settings, and both authentication case configs.
    • bash -n tests/integration_tests/_utils/run_cdc_server tests/integration_tests/cli_with_auth/run.sh tests/integration_tests/cli_tls_with_auth/run.sh — passed.
    • tools/bin/shfmt -d tests/integration_tests/_utils/run_cdc_server tests/integration_tests/cli_with_auth/run.sh tests/integration_tests/cli_tls_with_auth/run.sh — passed.
    • git diff --check — passed.

Kafka integration tests were not run locally because required cluster binaries were unavailable.

Questions

Will it cause performance regression or break compatibility?

Client selection happens when sink options are constructed. The server default remains Sarama, and explicit URI selections retain their behavior. Kafka integration tests opt in to franz-go through their server configuration.

Do you need to update user documentation, design documentation or monitoring documentation?

No. This is a temporary debug option for the franz-go migration.

Release note

None

Summary by CodeRabbit

  • New Features

    • Added a debug configuration option to use the franz-go Kafka client by default.
    • Kafka client selection can still be overridden per connection using the kafka-client URI parameter.
    • Invalid Kafka client values continue to be rejected.
  • Configuration

    • Integration test server configurations now enable franz-go Kafka support by default.
  • Bug Fixes

    • Improved handling and validation of expected errors when Kafka is unavailable in Glue-related changefeed scenarios.

Add a temporary server default while preserving explicit URI selections.
Enable franz-go in integration test startup configuration and cover config
merging with regression tests. Remove the mistakenly committed root
server.toml.
Select a shared default config in the integration-test launcher and let
explicit test configs override it. Enable franz-go in Kafka authentication
case configs and remove the generic config injection and its script test.
@ti-chi-bot ti-chi-bot added component/kafka TiCDC kafka sink component/test Unit tests and integration tests component. lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 21, 2026
@ti-chi-bot ti-chi-bot added type/cherry-pick-for-release-nextgen-202609 type/enhancement The issue or PR belongs to an enhancement. labels Oct 21, 2026
@ti-chi-bot

ti-chi-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

This cherry pick PR is for a release branch and has not yet been approved by triage owners.
Adding the do-not-merge/cherry-pick-not-approved label.

To merge this cherry pick:

  1. It must be LGTMed and approved by the reviewers firstly.
  2. For pull requests to TiDB-x branches, it must have no failed tests.
  3. AFTER it has lgtm and approved labels, please wait for the cherry-pick merging approval from triage owners.
Details

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.

@ti-chi-bot

ti-chi-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nongfushanquan for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a15a41e7-d358-4248-b5f3-6eab6633e1c1
📥 Commits

Reviewing files that changed from the base of the PR and between 42810db and 03f6418.

📒 Files selected for processing: 10
  • pkg/config/debug.go
  • pkg/config/server_config_test.go
  • pkg/sink/kafka/options.go
  • pkg/sink/kafka/options_test.go
  • server.toml
  • tests/integration_tests/_utils/cdc_server.toml
  • tests/integration_tests/_utils/run_cdc_server
  • tests/integration_tests/cli_tls_with_auth/run.sh
  • tests/integration_tests/cli_with_auth/run.sh
  • tests/integration_tests/http_api/util/test_case.py
💤 Files with no reviewable changes: 1
  • server.toml

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The change adds a server-level franz-go default for Kafka sinks, with explicit kafka-client URI values taking precedence. Integration test configurations enable the default, and an HTTP API test now checks mode-specific error responses.

Changes: Kafka Client Default and Integration Tests

Layer / File(s) Summary
Kafka client configuration and selection
pkg/config/debug.go, pkg/config/server_config_test.go, pkg/sink/kafka/options.go, pkg/sink/kafka/options_test.go
DebugConfig gains EnableKafkaFranzGo. NewOptions uses franz-go when enabled and keeps Sarama as the default otherwise. Tests cover config decoding, cloning, URI overrides, and invalid client values.
Integration server configuration
tests/integration_tests/_utils/cdc_server.toml, tests/integration_tests/_utils/run_cdc_server, tests/integration_tests/cli_tls_with_auth/run.sh, tests/integration_tests/cli_with_auth/run.sh, server.toml
Integration server configurations enable franz-go. The runner defaults to the adjacent cdc_server.toml, and server.toml is removed.
HTTP API error expectations
tests/integration_tests/http_api/util/test_case.py
The test checks exact status and error-code values according to TICDC_NEWARCH.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Suggested reviewers: 3aceshowhand, wk989898

Merge Risk: ⚪ Minimal · up to 03f64

No actionable merge-blocking risk is established. The Kafka integration tests remain to be run in an environment with the required cluster binaries.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 7 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: adding a server debug switch for franz-go and enabling it in CI.
Description check Passed The description includes the required issue reference, change summary, test results, compatibility assessment, documentation assessment, and release note. It also states that Kafka integration tests w…
Linked Issues check Passed Issue #6566 is closed and supplies historical context only. No active directly linked issue remains, so this pull request has no active linked-issue coding requirements to assess.
Out of Scope Changes check Passed The changes stay within the stated franz-go migration scope. They add and test the server debug option, preserve URI client precedence, configure integration-test servers, update the related integrati…
Full details: Description check

Explanation

The description includes the required issue reference, change summary, test results, compatibility assessment, documentation assessment, and release note. It also states that Kafka integration tests were not run and explains why.

Full details: Out of Scope Changes check

Explanation

The changes stay within the stated franz-go migration scope. They add and test the server debug option, preserve URI client precedence, configure integration-test servers, update the related integration-test expectation, and remove the mistakenly committed root server.toml.

Full details: Docstring Coverage

Explanation

Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 7 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

A rabbit checks the Kafka switch,
Franz hops in as default choice.
URI settings still take lead,
Tests confirm each path and code,
The burrow hums with config joy.

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/kafka TiCDC kafka sink component/test Unit tests and integration tests component. do-not-merge/cherry-pick-not-approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-nextgen-202609 type/enhancement The issue or PR belongs to an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants