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

support ticdc data dir #1372

Merged

Conversation

3AceShowHand
Copy link
Contributor

@3AceShowHand 3AceShowHand commented May 19, 2021

What problem does this PR solve?

For TiCDC, it might create a sort-dir to store temporary files for sort. In this PR, add data-dir to TiCDC, which can be used to store any temporary files generated by TiCDC instance.

What is changed and how it works?

  • add DataDir field at CDCSpec

There are two scenarios:

  1. for version < v4.0.13, does not show data-dir in confirm information. even user set data-dir, it does not work.
  2. for version >= v4.0.13 && version != v5.0.0-RC, show data-dir, and create it, and start CDC instance by using it.

Check List

Tests

  • No code

Code changes

  • Has exported variable/fields change

Side effects

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release notes:

NONE

NONE

@ti-chi-bot ti-chi-bot requested a review from AstroProfundis May 19, 2021 13:00
@ti-chi-bot ti-chi-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 19, 2021
@codecov-commenter
Copy link

codecov-commenter commented May 19, 2021

Codecov Report

Merging #1372 (c2ec4db) into master (5928416) will increase coverage by 28.86%.
The diff coverage is 56.25%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1372       +/-   ##
===========================================
+ Coverage   25.26%   54.13%   +28.86%     
===========================================
  Files         266      291       +25     
  Lines       20589    22494     +1905     
===========================================
+ Hits         5202    12177     +6975     
+ Misses      14585     8383     -6202     
- Partials      802     1934     +1132     
Flag Coverage Δ
cluster 41.87% <56.25%> (?)
dm 24.46% <2.08%> (?)
integrate 48.70% <56.25%> (+33.19%) ⬆️
playground 13.73% <0.00%> (?)
tiup 15.49% <0.00%> (-0.02%) ⬇️
unittest 21.66% <8.33%> (+0.08%) ⬆️

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

Impacted Files Coverage Δ
pkg/cluster/manager/check.go 70.58% <0.00%> (+70.58%) ⬆️
pkg/cluster/template/scripts/cdc.go 59.09% <33.33%> (+59.09%) ⬆️
pkg/cluster/manager/deploy.go 71.07% <50.00%> (+71.07%) ⬆️
pkg/cluster/manager/scale_out.go 46.23% <60.00%> (+37.34%) ⬆️
pkg/cluster/spec/cdc.go 82.08% <77.77%> (+79.05%) ⬆️
pkg/cluster/manager/upgrade.go 59.20% <100.00%> (+53.55%) ⬆️
pkg/cluster/spec/spec.go 87.54% <100.00%> (+29.23%) ⬆️
pkg/logger/logger.go 100.00% <0.00%> (ø)
pkg/cluster/operation/operation.go 78.26% <0.00%> (ø)
pkg/logger/debug.go 16.66% <0.00%> (ø)
... and 217 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5928416...c2ec4db. Read the comment docs.

@3AceShowHand
Copy link
Contributor Author

/run-all-tests

Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

Could you add some tests?

E.g., tests like

func (s *metaSuiteTopo) TestDefaultDataDir(c *C) {
// Test with without global DataDir.
topo := new(Specification)
topo.TiKVServers = append(topo.TiKVServers, &TiKVSpec{Host: "1.1.1.1", Port: 22})
data, err := yaml.Marshal(topo)
c.Assert(err, IsNil)
// Check default value.
topo = new(Specification)
err = yaml.Unmarshal(data, topo)
c.Assert(err, IsNil)
c.Assert(topo.GlobalOptions.DataDir, Equals, "data")
c.Assert(topo.TiKVServers[0].DataDir, Equals, "data")

Rest LGTM

embed/templates/scripts/run_cdc.sh.tpl Outdated Show resolved Hide resolved
components/client/go.mod Show resolved Hide resolved
pkg/cluster/spec/cdc.go Show resolved Hide resolved
@ti-chi-bot ti-chi-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 20, 2021
@3AceShowHand
Copy link
Contributor Author

/run-all-tests

if semver.Compare(clusterVersion, "v4.0.13") >= 0 && clusterVersion != "v5.0.0-rc" {
configFileSupported = true
dataDirSupported = true
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 a dedicated if block, so that the error message can be specific to data_dir.

Copy link
Contributor

Choose a reason for hiding this comment

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

and did you make sure v5.0 series versions except v5.0.0-rc support the --sort-dir argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it's checked at the source code level.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

better use a dedicated if block, so that the error message can be specific to data_dir.

I don't think we have to throw an error message on data-dir, the reason is described above.

@3AceShowHand 3AceShowHand force-pushed the ling.jin/support-ticdc-data-dir branch from 46e617d to 6439c29 Compare May 24, 2021 06:32
@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 24, 2021
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 24, 2021
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 24, 2021
@overvenus
Copy link
Member

/lgtm

@ti-chi-bot
Copy link
Member

@overvenus: Thanks for your review. The bot only counts /lgtm 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.

pkg/cluster/spec/spec.go Outdated Show resolved Hide resolved
@3AceShowHand 3AceShowHand requested a review from lucklove May 26, 2021 05:43
@3AceShowHand
Copy link
Contributor Author

/run-all-tests

@lucklove
Copy link
Member

/lgtm

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lucklove

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 26, 2021
@AstroProfundis AstroProfundis added this to the v1.5.0 milestone May 28, 2021
@3AceShowHand
Copy link
Contributor Author

@AstroProfundis
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: c2ec4db

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 1, 2021
@ti-chi-bot ti-chi-bot merged commit b12ae28 into pingcap:master Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Denotes a PR that changes 100-499 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.

6 participants