server: deduplicate merged PD endpoints before upstream store init

Open Beginner friendly
#4,586 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go
Domain
backend

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.

Description

severity/major type/bug

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
Dominant language
Go
Stars
56
Forks
63
Avg merge
2d 17h
Merged PRs (30d)
43

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pingcap/ticdc

All issues in pingcap/ticdc

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.