Skip to content

deps: bump client-go for nextgen shared lock#5203

Open
cfzjywxk wants to merge 2 commits into
pingcap:release-nextgen-202603from
cfzjywxk:release-nextgen-202603-client-go-shared-lock
Open

deps: bump client-go for nextgen shared lock#5203
cfzjywxk wants to merge 2 commits into
pingcap:release-nextgen-202603from
cfzjywxk:release-nextgen-202603-client-go-shared-lock

Conversation

@cfzjywxk
Copy link
Copy Markdown

@cfzjywxk cfzjywxk commented Jun 5, 2026

What problem does this PR solve?

Issue Number: ref pingcap/tidb#66154

Related TiCDC compatibility issue: #5206

The TiCDC nextgen 202603 release branch still depends on an older github.com/tikv/client-go/v2 revision that does not contain the API v2 lock-key re-encoding fix needed by the TiDB shared-lock feature.

Client-go fix PR: tikv/client-go#1987

This PR consumes the minimal client-go branch for TiCDC:

What is changed and how it works?

  • Bump github.com/tikv/client-go/v2 to the minimal 78dc334 pseudo-version.
  • Bump github.com/pingcap/kvproto only as required by that client-go version.
  • Keep github.com/tikv/pd/client, google.golang.org/grpc, and golang.org/x/* unchanged.
  • Make mysql progress table flush order deterministic. The dependency bump exposed an order-sensitive local nextgen unit test around map-backed table-name iteration. The sort now uses slices.SortFunc and cmp.Compare per review feedback.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test

Local checks run:

  • make tidy
  • NEXT_GEN=1 make cdc
  • NEXT_GEN=1 make integration_test_build_fast
  • CGO_ENABLED=1 go test -v -timeout 300s -p 1 --race --tags=intest,nextgen ./pkg/sink/mysql -run 'TestProgressTableWriterFlush(Single|Multi)Batch' -count=5 with failpoints enabled

Full nextgen unit CI should be judged by GitHub CI.

Questions

Will it cause performance regression or break compatibility?

No expected compatibility impact. The dependency change is limited to client-go and its required kvproto version for shared-lock support. The progress-table ordering change sorts table names before batching progress-table writes, which only makes output deterministic.

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

No.

Release note

None.

@ti-chi-bot ti-chi-bot Bot added release-note-none Denotes a PR that doesn't merit a release note. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. labels Jun 5, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5a39813f-ff56-4138-b9a3-12ddb0a76912

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

@pingcap-cla-assistant
Copy link
Copy Markdown

pingcap-cla-assistant Bot commented Jun 5, 2026

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 5, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates dependencies and sorts the tableNames slice in progress_table_writer.go by schema and table name before flushing. The review feedback suggests utilizing the more performant and type-safe slices and cmp packages introduced in Go 1.21 instead of sort.Slice, and recommends defensively handling potential nil elements in the slice to prevent nil-pointer dereference panics.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread pkg/sink/mysql/progress_table_writer.go Outdated
"context"
"database/sql"
"fmt"
"sort"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since Go 1.21, the slices and cmp packages are preferred over sort.Slice for type-safe and reflection-free sorting. Replacing sort with slices and cmp.

Suggested change
"sort"
"cmp"
"slices"

Comment thread pkg/sink/mysql/progress_table_writer.go Outdated
Comment on lines +103 to +108
sort.Slice(tableNames, func(i, j int) bool {
if tableNames[i].SchemaName != tableNames[j].SchemaName {
return tableNames[i].SchemaName < tableNames[j].SchemaName
}
return tableNames[i].TableName < tableNames[j].TableName
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using sort.Slice has performance overhead due to reflection. Since Go 1.21, slices.SortFunc is the idiomatic and more performant way to sort slices.

Additionally, since tableNames contains pointers (*event.SchemaTableName), we should defensively handle potential nil elements to avoid nil-pointer dereference panics.

	slices.SortFunc(tableNames, func(a, b *event.SchemaTableName) int {
		if a == nil && b == nil {
			return 0
		}
		if a == nil {
			return -1
		}
		if b == nil {
			return 1
		}
		if a.SchemaName != b.SchemaName {
			return cmp.Compare(a.SchemaName, b.SchemaName)
		}
		return cmp.Compare(a.TableName, b.TableName)
	})

@3AceShowHand
Copy link
Copy Markdown
Collaborator

/test all

@cfzjywxk cfzjywxk force-pushed the release-nextgen-202603-client-go-shared-lock branch 2 times, most recently from 3378222 to 2469f4f Compare June 5, 2026 07:24
@cfzjywxk
Copy link
Copy Markdown
Author

cfzjywxk commented Jun 5, 2026

/test all

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Jun 5, 2026

@cfzjywxk: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cdc-kafka-integration-light 2469f4f link true /test pull-cdc-kafka-integration-light
pull-cdc-storage-integration-light 2469f4f link true /test pull-cdc-storage-integration-light
pull-cdc-mysql-integration-light 2469f4f link true /test pull-cdc-mysql-integration-light
pull-cdc-kafka-integration-heavy 2469f4f link true /test pull-cdc-kafka-integration-heavy
pull-cdc-storage-integration-heavy 2469f4f link true /test pull-cdc-storage-integration-heavy
pull-cdc-mysql-integration-heavy 2469f4f link true /test pull-cdc-mysql-integration-heavy
pull-cdc-pulsar-integration-heavy 2469f4f link false /test pull-cdc-pulsar-integration-heavy
pull-cdc-pulsar-integration-light 2469f4f link false /test pull-cdc-pulsar-integration-light

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

cfzjywxk added 2 commits June 5, 2026 15:39
Bump client-go to the minimal release-nextgen-202603-ticdc pseudo-version that contains the API v2 lock-key re-encoding fix for shared lock support.

Only the required kvproto version moves with client-go. Keep pd/client, grpc, and golang.org/x dependencies unchanged to limit the release branch diff.

Signed-off-by: cfzjywxk <cfzjywxk@gmail.com>
Sort progress table names before batching because TableSchemaStore is map-backed and may return table names in different orders across runs.

The progress writes are idempotent by table identity, but deterministic order keeps batch boundaries and SQL arguments reproducible for tests and debugging.

Signed-off-by: cfzjywxk <cfzjywxk@gmail.com>
@cfzjywxk cfzjywxk force-pushed the release-nextgen-202603-client-go-shared-lock branch from 2469f4f to a518542 Compare June 5, 2026 07:40
@cfzjywxk
Copy link
Copy Markdown
Author

cfzjywxk commented Jun 5, 2026

@tenfyzhong PTAL

The ticdc release-nextgen-202603 CI cannot find the TiDB artifact for release-nextgen-202603_linux_amd64, not sure if this branch CI runs regularly.

ti-chi-bot Bot pushed a commit to PingCAP-QE/ci that referenced this pull request Jun 5, 2026
### What changed

Remove `^release-nextgen-\d+$` from the regular TiCDC presubmit branch
set in `prow-jobs/pingcap/ticdc/latest-presubmits.yaml`.

The next-gen presubmits in
`prow-jobs/pingcap/ticdc/latest-presubmits-next-gen.yaml` still match
`release-nextgen-*` branches.

### Why

TiCDC PRs targeting `release-nextgen-202603` currently trigger regular
jobs such as `pull-cdc-pulsar-integration-light` when `/test all` is
used. Those regular jobs download TiDB, PD, and TiKV artifacts from the
normal `hub` OCI registry, but next-gen artifacts are handled by the
`*_next_gen` pipelines through the `tidbx` registry.

This caused artifact lookup failures like:


`us-docker.pkg.dev/pingcap-testing-account/hub/pingcap/tidb/package:release-nextgen-202603_linux_amd64:
not found`

Ref: pingcap/ticdc#5203

### Verification

Parsed the Prow YAML locally and checked branch/trigger selection for
`release-nextgen-202603`:

- Before this change, `/test all` selected the regular TiCDC integration
jobs.
- After this change, `/test all` selects no regular TiCDC jobs on
`release-nextgen-202603`.
- `/test next-gen` still selects the `*_next_gen` TiCDC integration
jobs.
- `/test pull-cdc-pulsar-integration-light-next-gen` still selects
`pull_cdc_pulsar_integration_light_next_gen`.
- `master`, `release-8.5`, and `feature/foo` still select the regular
`/test all` jobs.

Also ran `git diff --check` for the changed file.

Signed-off-by: cfzjywxk <cfzjywxk@gmail.com>
@cfzjywxk
Copy link
Copy Markdown
Author

cfzjywxk commented Jun 5, 2026

/test next-gen

Comment thread go.mod
github.com/stretchr/testify v1.11.1
github.com/thanhpk/randstr v1.0.6
github.com/tikv/client-go/v2 v2.0.8-0.20251112113123-1264c1278595
github.com/tikv/client-go/v2 v2.0.8-0.20260605035552-78dc334b882b
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is not the latest client-go commit on the release-nextgen-202603 branch?

Copy link
Copy Markdown
Author

@cfzjywxk cfzjywxk Jun 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wfxr It is desigend to not use the latest one to minialize the change risk for ticdc, the branch https://github.com/tikv/client-go/tree/release-nextgen-202603-ticdc is used

@cfzjywxk
Copy link
Copy Markdown
Author

cfzjywxk commented Jun 5, 2026

nextgen ci test passes

pending checks
[tide](https://prow.tidb.net/tide)
tideWaiting for status to be reported — Not mergeable. Merging to branch release-nextgen-202603 is forbidden.
successful checks
CodeRabbit
CodeRabbit — Review skipped
[license/cla](https://cla.pingcap.net/pingcap/ticdc?pullRequest=5203)
license/cla — Contributor License Agreement is signed.
[pull-cdc-kafka-integration-heavy-next-gen](https://prow.tidb.net/jenkins/job/pingcap/job/ticdc/job/pull_cdc_kafka_integration_heavy_next_gen/482/display/redirect)
pull-cdc-kafka-integration-heavy-next-gen — Jenkins job succeeded.                   BaseSHA:757748409a1a08f11d8093e08f8d67b62532ff5d
[pull-cdc-kafka-integration-light-next-gen](https://prow.tidb.net/jenkins/job/pingcap/job/ticdc/job/pull_cdc_kafka_integration_light_next_gen/362/display/redirect)
pull-cdc-kafka-integration-light-next-gen — Jenkins job succeeded.                   BaseSHA:757748409a1a08f11d8093e08f8d67b62532ff5d
[pull-cdc-mysql-integration-heavy-next-gen](https://prow.tidb.net/jenkins/job/pingcap/job/ticdc/job/pull_cdc_mysql_integration_heavy_next_gen/374/display/redirect)
pull-cdc-mysql-integration-heavy-next-gen — Jenkins job succeeded.                   BaseSHA:757748409a1a08f11d8093e08f8d67b62532ff5d
[pull-cdc-mysql-integration-light-next-gen](https://prow.tidb.net/jenkins/job/pingcap/job/ticdc/job/pull_cdc_mysql_integration_light_next_gen/2365/display/redirect)
pull-cdc-mysql-integration-light-next-gen — Jenkins job succeeded.                   BaseSHA:757748409a1a08f11d8093e08f8d67b62532ff5d
[pull-cdc-pulsar-integration-heavy-next-gen](https://prow.tidb.net/jenkins/job/pingcap/job/ticdc/job/pull_cdc_pulsar_integration_heavy_next_gen/454/display/redirect)
pull-cdc-pulsar-integration-heavy-next-gen — Jenkins job succeeded.                   BaseSHA:757748409a1a08f11d8093e08f8d67b62532ff5d
[pull-cdc-pulsar-integration-light-next-gen](https://prow.tidb.net/jenkins/job/pingcap/job/ticdc/job/pull_cdc_pulsar_integration_light_next_gen/453/display/redirect)
pull-cdc-pulsar-integration-light-next-gen — Jenkins job succeeded.                   BaseSHA:757748409a1a08f11d8093e08f8d67b62532ff5d
[pull-cdc-storage-integration-heavy-next-gen](https://prow.tidb.net/jenkins/job/pingcap/job/ticdc/job/pull_cdc_storage_integration_heavy_next_gen/359/display/redirect)
pull-cdc-storage-integration-heavy-next-gen — Jenkins job succeeded.                   BaseSHA:757748409a1a08f11d8093e08f8d67b62532ff5d
[pull-cdc-storage-integration-light-next-gen](https://prow.tidb.net/jenkins/job/pingcap/job/ticdc/job/pull_cdc_storage_integration_light_next_gen/362/display/redirect)
pull-cdc-storage-integration-light-next-gen — Jenkins job succeeded.                   BaseSHA:757748409a1a08f11d8093e08f8d67b62532ff5d
No conflicts with base branch
Changes can be cleanly merged.

@cfzjywxk
Copy link
Copy Markdown
Author

cfzjywxk commented Jun 5, 2026

@tenfyzhong PTAL

The ticdc release-nextgen-202603 CI cannot find the TiDB artifact for release-nextgen-202603_linux_amd64, not sure if this branch CI runs regularly.

@3AceShowHand @wk989898 PTAL

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Jun 7, 2026

@wfxr: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In response to this:

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
Copy link
Copy Markdown

ti-chi-bot Bot commented Jun 7, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: wfxr
Once this PR has been reviewed and has the lgtm label, please assign flowbehappy 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

if len(tableNames) == 0 {
return nil
}
// TableSchemaStore stores table names in maps, so the returned order is not
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need a strict order here, so we don't need to make this change.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used to make the flaky test TestProgressTableWriterFlush stable, should we keep the change to avoid the current flaky tests or to change the test case? What do you think?

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

Labels

first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants