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

cluster: Support TiKV-CDC component #2022

Merged
merged 18 commits into from
Sep 14, 2022
Merged

Conversation

pingyu
Copy link
Contributor

@pingyu pingyu commented Aug 15, 2022

Issue Number: #1999

Signed-off-by: pingyu [email protected]

What problem does this PR solve?

#1999

What is changed and how it works?

TiUP cluster supports the TiKV-CDC component.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
➜  tiup-cluster deploy up v6.2.0 up.yaml
...
...
Cluster `up` deployed successfully, you can start it with command: `tiup-cluster start up --init`
➜  tiup-cluster start up -y
Starting cluster up...
...
...
Started cluster `up` successfully
➜  tiup-cluster display up
Cluster type:       tidb
Cluster name:       up
Cluster version:    v6.2.0
Deploy user:        root
SSH type:           builtin
...
...
Total nodes: 14
➜ tikv-cdc cli --pd 10.2.x.x:2379 capture list
[
  {
    "id": "3e2ede2a-13ad-4ded-8ac6-1c5f315dfd5e",
    "is-owner": false,
    "address": "10.2.x.x:8600"
  },
  {
    "id": "7b68a84e-63d5-4fd2-89a6-90aa15a7069c",
    "is-owner": false,
    "address": "10.2.x.x:8600"
  },
  {
    "id": "a05ae66d-6dcf-4c28-b0d2-0cab3a221dfc",
    "is-owner": true,
    "address": "10.2.x.x:8600"
  }
]
➜

Code changes

  • Has exported variable/fields change
    • spec.TiKVCDCSpec, scripts.TiKVCDCScript, api.TiKVCDCOpenAPIClient
    • spec.ServerConfigs.TiKVCDC, spec.Specification.TiKVCDCServers, instance.ComponentTiKVCDC

Side effects

  • Increased code complexity

Related changes

  • Need to update the documentation
    • TBD

Release notes:

TiUP cluster supports the `TiKV-CDC` component.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 15, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • nexustar

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Aug 15, 2022
Signed-off-by: pingyu <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Aug 15, 2022

Codecov Report

Base: 47.67% // Head: 51.46% // Increases project coverage by +3.79% 🎉

Coverage data is based on head (5304c07) compared to base (fb81eac).
Patch coverage: 36.87% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2022      +/-   ##
==========================================
+ Coverage   47.67%   51.46%   +3.79%     
==========================================
  Files         309      312       +3     
  Lines       36042    36379     +337     
==========================================
+ Hits        17182    18720    +1538     
+ Misses      16836    15436    -1400     
- Partials     2024     2223     +199     
Flag Coverage Δ
cluster 39.88% <36.87%> (+6.64%) ⬆️
dm 23.82% <0.00%> (-0.22%) ⬇️
playground 13.01% <0.00%> (-0.19%) ⬇️
tiup 14.01% <0.00%> (-0.23%) ⬇️
unittest 20.57% <3.30%> (-0.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/cluster/api/tikv_cdc.go 0.00% <0.00%> (ø)
pkg/cluster/spec/tikv_cdc.go 45.81% <45.81%> (ø)
pkg/cluster/template/scripts/tikv_cdc.go 72.09% <72.09%> (ø)
pkg/cluster/spec/bindversion.go 90.91% <100.00%> (ø)
pkg/cluster/spec/monitoring.go 73.86% <100.00%> (-1.68%) ⬇️
pkg/cluster/spec/spec.go 83.37% <100.00%> (+3.52%) ⬆️
pkg/cluster/task/update_meta.go 74.07% <100.00%> (-12.06%) ⬇️
pkg/cluster/template/config/prometheus.go 81.44% <100.00%> (+0.59%) ⬆️
pkg/tidbver/tidbver.go 95.12% <100.00%> (+0.39%) ⬆️
pkg/cluster/api/cdcapi.go 0.00% <0.00%> (-56.12%) ⬇️
... and 80 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

pingyu added 4 commits August 15, 2022 21:25
Signed-off-by: pingyu <[email protected]>
Signed-off-by: pingyu <[email protected]>
@pingyu pingyu changed the title [Draft] cluster: Support TiKV-CDC component cluster: Support TiKV-CDC component Aug 16, 2022
Signed-off-by: pingyu <[email protected]>
@pingyu
Copy link
Contributor Author

pingyu commented Aug 17, 2022

@nexustar PTAL, thanks~

@pingyu
Copy link
Contributor Author

pingyu commented Aug 18, 2022

/cc @haojinming @zeminzhou

@ti-chi-bot
Copy link
Member

@pingyu: GitHub didn't allow me to request PR reviews from the following users: haojinming, zeminzhou.

Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @haojinming @zeminzhou

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/test-infra repository.

Copy link

@haojinming haojinming left a comment

Choose a reason for hiding this comment

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

LGTM~

@ti-chi-bot
Copy link
Member

@haojinming: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

In response to this:

LGTM~

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 ti-community-infra/tichi repository.

@zeminzhou
Copy link

LGTM~

@nexustar nexustar added this to the v1.11.0 milestone Aug 25, 2022
@ti-chi-bot
Copy link
Member

@zeminzhou: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments.

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 ti-community-infra/tichi repository.

@@ -28,7 +28,8 @@ func TiDBComponentVersion(comp, version string) string {
ComponentPushwaygate,
ComponentCheckCollector,
ComponentSpark,
ComponentTiSpark:
ComponentTiSpark,
ComponentTiKVCDC: // TiKV-CDC use individual version.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any compatibility requirement or the user can always use the latest version of TiKV-CDC regardless of the TiDB version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No requirement. User can always use the latest version by now, and we will maintain the compatibility.

@@ -112,6 +112,7 @@ type (
Pump map[string]interface{} `yaml:"pump"`
Drainer map[string]interface{} `yaml:"drainer"`
CDC map[string]interface{} `yaml:"cdc"`
TiKVCDC map[string]interface{} `yaml:"tikv-cdc"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Better use tikv_cdc to keep the same naming format with other components.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason why I chose tikv-cdc is that:

  1. I refer to this PR that using tidb-dashboard & tidb-dashboard_servers.
  2. The binary is named as tikv-cdc, so using tikv_cdc will be error-prone, e.g. run_tikv-cdc.sh.tpl will has both tikv-cdc & tikv_cdc.

Or how about using kvcdc ? Just as what we add to playground (#2000) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think #2017 should also change to use identical name formatting, I'm absolutely sure that mixing - and _ in the same key name will cause chaos to the end users.

kvcdc would be a good choice IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay~ I will change to kvcdc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. PTAL~

@@ -127,6 +128,7 @@ type (
PumpServers []*PumpSpec `yaml:"pump_servers,omitempty"`
Drainers []*DrainerSpec `yaml:"drainer_servers,omitempty"`
CDCServers []*CDCSpec `yaml:"cdc_servers,omitempty"`
TiKVCDCServers []*TiKVCDCSpec `yaml:"tikv-cdc_servers,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto, tikv_cdc_servers

native_ssh=true
shift
;;
--staging)
Copy link
Contributor

Choose a reason for hiding this comment

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

This staging mirror is not used anywhere in this PR

version="nightly"
topo_name="tikv_cdc"
test_tls=false
mirror="https://tiup-mirrors.pingcap.com/"
Copy link
Contributor

Choose a reason for hiding this comment

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

tiup mirror set --reset will do the same as tiup mirror set https://tiup-mirrors.pingcap.com

done

# set mirror
tiup mirror set $mirror
Copy link
Contributor

Choose a reason for hiding this comment

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

as the staging mirror is not used, i think it's not necessary to build tiup and use it to manually set the mirror.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tiup is also used for installing tikv-cdc component for test case of tiup cluster patch. I remove the tiup mirror here, but keep the tiup target & function.

Imported bool `yaml:"imported,omitempty"`
Patched bool `yaml:"patched,omitempty"`
IgnoreExporter bool `yaml:"ignore_exporter,omitempty"`
Port int `yaml:"port" default:"8600"`
Copy link
Contributor

Choose a reason for hiding this comment

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

The port should also be added to portTypes list in pkg/cluster/spec/validate.go at around L619, other wise the port conflict check is not working for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found that the Port is already in the list for portTypes where portConflictsDetect get port value from. So the port conflict check should work.

And I add a test case to verify port conflict check in integrated test for tikv-cdc. PTAL~

@pingyu
Copy link
Contributor Author

pingyu commented Sep 9, 2022

@AstroProfundis Thanks for your review ! All comments are addressed or replied, PTAL~

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 13, 2022
@nexustar
Copy link
Collaborator

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: c1e81fd

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 13, 2022
@ti-chi-bot
Copy link
Member

@pingyu: Your PR was out of date, I have automatically updated it for you.

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Sep 13, 2022
@pingyu
Copy link
Contributor Author

pingyu commented Sep 14, 2022

Added cluster version check. PTAL, thanks~

@nexustar
Copy link
Collaborator

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 5304c07

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 14, 2022
@ti-chi-bot ti-chi-bot merged commit d6a2826 into pingcap:master Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants