Skip to content

etcd(ticdc): update etcd cluster member correctly#12646

Merged
ti-chi-bot[bot] merged 6 commits into
pingcap:masterfrom
wk989898:etcd-0521
May 25, 2026
Merged

etcd(ticdc): update etcd cluster member correctly#12646
ti-chi-bot[bot] merged 6 commits into
pingcap:masterfrom
wk989898:etcd-0521

Conversation

@wk989898

@wk989898 wk989898 commented May 21, 2026

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: close #12368

What is changed and how it works?

When updating etcd client URLs, remove the client that is not a member of the etcd cluster.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
tiup playground $VERSION --db 1 --kv 1 --pd 3 --ticdc 1 --tiflash 0 --without-monitor
tiup cdc:$VERSION cli changefeed create --sink-uri 'blackhole://'
tiup playground scale-out --pd 1
tiup playground display
tiup playground scale-in --pid 153389 # pick any one from the display

Print only once

[2026/05/21 10:03:39.588 +00:00] [INFO] [client.go:447] ["update endpoints"] [numChange=3->4] [lastEndpoints="[http://127.0.0.1:2382,http://127.0.0.1:2379,http://127.0.0.1:2384]"] [endpoints="[http://127.0.0.1:44765,http://127.0.0.1:2382,http://127.0.0.1:2384,http://127.0.0.1:2379]"]

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

Fixed the bug of using an incorrect etcd client when scaling PD nodes

Signed-off-by: wk989898 <nhsmwk@gmail.com>
@ti-chi-bot ti-chi-bot Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 21, 2026

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

Copy link
Copy Markdown

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 the update method in pkg/etcd/client.go to synchronize the internal client cache with a provided list of endpoints, ensuring that stale clients are removed. The review feedback identifies a potential resource leak where clients are deleted without being closed and suggests a performance optimization by pre-allocating the map capacity.

Comment thread pkg/etcd/client.go
Comment thread pkg/etcd/client.go Outdated
wk989898 and others added 2 commits May 21, 2026 14:47
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: wk989898 <nhsmwk@gmail.com>
@ti-chi-bot ti-chi-bot Bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 21, 2026
Signed-off-by: wk989898 <nhsmwk@gmail.com>
@joechenrh

Copy link
Copy Markdown
Contributor

/retest

Signed-off-by: wk989898 <nhsmwk@gmail.com>
@ti-chi-bot ti-chi-bot Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 21, 2026
Signed-off-by: wk989898 <nhsmwk@gmail.com>
@ti-chi-bot ti-chi-bot Bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels May 22, 2026
@ti-chi-bot ti-chi-bot Bot added the lgtm label May 22, 2026
@ti-chi-bot

ti-chi-bot Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: asddongmen, lidezhu

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

The pull request process is described 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

@ti-chi-bot ti-chi-bot Bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label May 22, 2026
@ti-chi-bot

ti-chi-bot Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

[LGTM Timeline notifier]

Timeline:

  • 2026-05-22 13:19:52.307440159 +0000 UTC m=+12662.277605224: ☑️ agreed by lidezhu.
  • 2026-05-22 14:36:14.56699746 +0000 UTC m=+17244.537162517: ☑️ agreed by asddongmen.

@wk989898

Copy link
Copy Markdown
Collaborator Author

/retest

@ti-chi-bot ti-chi-bot Bot merged commit c958650 into pingcap:master May 25, 2026
35 checks passed
@wk989898 wk989898 added needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. labels May 25, 2026
@ti-chi-bot

Copy link
Copy Markdown
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #12649.

@ti-chi-bot

Copy link
Copy Markdown
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #12650.

@ti-chi-bot

Copy link
Copy Markdown
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #12651.

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

Labels

approved lgtm needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TiCDC keeps adding a scaled-in PD back as etcd endpoints

5 participants