Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TiCDC cluster suffers a round robin owner election during rolling update #3529

Closed
Tracked by #4757
amyangfei opened this issue Nov 18, 2021 · 3 comments
Closed
Tracked by #4757
Assignees
Labels
area/ticdc Issues or PRs related to TiCDC. severity/moderate subject/new-feature Denotes an issue or pull request adding a new feature. type/bug The issue is confirmed as a bug.

Comments

@amyangfei
Copy link
Contributor

amyangfei commented Nov 18, 2021

What did you do?

  1. Create a TiCDC cluster with multiple nodes, such as 7 nodes.
  2. Rolling update the TiCDC cluster

What did you expect to see?

Replication continues normally during TiCDC is rolling update

What did you see instead?

Supposing the owner is restarted at first, then owner will be elected to each following TiCDC node(This is caused by the election way in etcd, it simply selects the election key with the smallest revision as the campaign winner), while the elected owner will be restarted soon by rolling update.

The initialization phase of a TiCDC owner could cost long time, it has many procedures, including initializing each existing changefeeds (when initializing a changefeed it will create a downstream sink, imaging we create a Kafka sink and do some verification jobs, it is heavy work).

Then we will waste a lot of time in each TiCDC owner node to do owner initialization. What's more, maybe no owner finishes initialization before it restarts, the replication checkpoint could pause during rolling update, and the longer rolling update takes, the larger replication lag may happen.

Versions of the cluster

Upstream TiDB cluster version (execute SELECT tidb_version(); in a MySQL client):

v5.3.0

TiCDC version (execute cdc version):

master@pingcap/ticdc@fe92b89

Brainstorming

  • When processing rolling update, update the TiCDC owner at last, then the owner will be transferred only once, and before the last node is restarted, the owner works as normal. (This may be simple, just change the deploy tools, but may be not reasonable, why should the deploy tool care about which node is TiCDC owner?)
  • Separate independent owner nodes, as what DM-master does in DM. We can update owner nodes first, then processor nodes. (This changes existing architecture of TiCDC)
  • Add an API to notify TiCDC cluster that it will go into a rolling update mode. When TiCDC enters rolling update mode, it will have special logic to avoid too much replication lag. (But this is too tricky)
  • Introduce a more intelligent leader election strategy? (Then we have to deal with consensus, it is complex)
@amyangfei amyangfei added type/bug The issue is confirmed as a bug. area/ticdc Issues or PRs related to TiCDC. labels Nov 18, 2021
@amyangfei
Copy link
Contributor Author

After discussion, we decide to make this a feature, for two reasons

  • Current behavior doesn't break TiCDC boundary (in extreme scenarios, there checkpoint lag could reach 10 minutes)
  • In the short term, we tend to update the rolling update strategy in TiUP or TiDB-operator to restart TiCDC owner at last.

@amyangfei amyangfei added the subject/new-feature Denotes an issue or pull request adding a new feature. label Nov 21, 2021
@overvenus
Copy link
Member

Since this issue doesn't break TiCDC boundary, change to severity/moderate.

@3AceShowHand
Copy link
Contributor

pingcap/tiup#1972

This is solved by supporting upgrade the owner at the last strategy in the PR above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ticdc Issues or PRs related to TiCDC. severity/moderate subject/new-feature Denotes an issue or pull request adding a new feature. type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants