server: deduplicate merged PD endpoints before upstream store init
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 56
- Forks
- 63
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 34
Description
Background
In the new architecture startup path, TiCDC seeds PD endpoints from the --pd CLI flag and then appends all PD member client URLs returned by CollectMemberEndpoints().
When the CLI already provides the full PD member list, the merged endpoint slice becomes duplicated, for example:
http://pd1:2379,http://pd2:2379,http://pd3:2379
-> append discovered members
http://pd1:2379,http://pd2:2379,http://pd3:2379,http://pd1:2379,http://pd2:2379,http://pd3:2379
That duplicated list is later converted into a tikv://host1:port,host2:port,... URI during upstream store initialization.
Problem
TiCDC currently appends discovered PD member endpoints without deduplication in server.prepare(). This makes the final endpoint list unstable and unnecessarily repeated during startup.
Expected behavior
The merged PD endpoint list should be deduplicated while preserving the original order of the first occurrence.
Suggested fix
Add a small helper in the new-arch server startup path to merge and deduplicate PD endpoints before the list is used by downstream initialization code.
Scope
- Minimal behavior change
- Preserve endpoint order
- Add focused unit tests for the merge behavior
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the new-architecture server.prepare() path and trace how --pd values are combined with CollectMemberEndpoints() before upstream store initialization. Add focused unit tests for merging endpoints, verifying that first-occurrence order is preserved and duplicates are removed. Done means the downstream endpoint list contains each endpoint once.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100