Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

*: put source/task tls config into etcd #1910

Merged
merged 57 commits into from
Aug 16, 2021

Conversation

Ehco1996
Copy link
Contributor

@Ehco1996 Ehco1996 commented Jul 25, 2021

What problem does this PR solve?

close #1909
close #1932
close #1956
#1982

What is changed and how it works?

  • update /tidb/dumpling/tidb-tools dependencies to the latest version

  • when the user has configured the SSL-related configuration, the contents of the certificate file are read and saved to the ETCD

  • In order to simulate this scenario in CI, the PR for the mysql SSL supported by CI must be merged before this PR

I've manually re-palyed the CI changes, link is here

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has exported function/method change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation
  • Need to update the dm/dm-ansible
  • Need to be included in the release note

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jul 25, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lance6716
  • lichunzhu

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.

@GMHDBJD GMHDBJD added this to the v2.0.6 milestone Jul 29, 2021
@Ehco1996 Ehco1996 changed the title *: put source tls config into etcd *: put source/task tls config into etcd Jul 29, 2021
Copy link
Contributor Author

@Ehco1996 Ehco1996 left a comment

Choose a reason for hiding this comment

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

Remove tidb_enable_change_column_type as tidb's defaultSysVars do not contain this key and dm-worker will panic if we pass in a variable that tidb does not RegisterSysVar.

@GMHDBJD GMHDBJD added this to the v2.1.0 milestone Aug 13, 2021
Copy link
Collaborator

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

rest lgtm

@ti-chi-bot ti-chi-bot added the status/LGT1 One reviewer already commented LGTM label Aug 16, 2021
Comment on lines 24 to 26
testdataPath = "./testdata"

caFile = "./testdata/ca.pem"
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using c.Mkdir() to save them in temporary files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in c5fb6a3

Comment on lines 59 to 63
if task.TargetDB != nil && task.TargetDB.Security != nil {
loadErr := task.TargetDB.Security.LoadTLSContent()
if loadErr != nil {
return loadErr
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems not compatible with the former version. If we still put TLS files on the dm-worker server we will fail to start a task now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I could add a hint to the error message to help the user locate the problem?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we ignore this error here and let the dm-worker take a try?
If it still fails to read tls content, we can report an error. If users have several sources/tasks using tls before, it might be hard for them to change their way to use DM.

Copy link
Contributor

Choose a reason for hiding this comment

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

Besides, I find that if we directly rolling upgrade DM from former version using MySQL tls, it seems that the former tasks will directly fail because they didn't have SSLCABytes in source config. Am I right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To ensure that tasks already using tls connections are not interrupted after this upgrade
Before the database connection is established, an attempt is made to read the configuration from the local disk

6d62706

cc @lance6716

echo "check data"
check_sync_diff $WORK_DIR $cur/conf/diff_config.toml

echo "pause task before kill and restart dm-worker"
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 we should delete tls files first to make sure we have ha.

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 don't think so, the worker doesn't read the certificate from the file in the code now,
we always read it from etcd, because we use this method to load the certificate (ToTLSConfigWithVerifyByRawbytes)

Copy link
Contributor

Choose a reason for hiding this comment

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

If dm-worker reads tls files from the local disk, we can also pass this test. Our test should make sure the former way fails this test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also added in 6d62706

Copy link
Contributor

@lichunzhu lichunzhu 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 ti-chi-bot added status/LGT2 Two reviewers already commented LGTM, ready for merge and removed status/LGT1 One reviewer already commented LGTM labels Aug 16, 2021
@Ehco1996 Ehco1996 removed the status/PTAL This PR is ready for review. Add this label back after committing new changes label Aug 16, 2021
@Ehco1996
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 39268c5

@ti-chi-bot ti-chi-bot merged commit 6d30e10 into pingcap:master Aug 16, 2021
@Ehco1996 Ehco1996 added the needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 label Aug 16, 2021
ti-chi-bot pushed a commit to ti-chi-bot/dm that referenced this pull request Aug 16, 2021
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #1998.

lichunzhu added a commit to lichunzhu/dm that referenced this pull request Sep 17, 2021
lichunzhu added a commit to lichunzhu/dm that referenced this pull request Sep 17, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 size/XXL status/can-merge status/LGT2 Two reviewers already commented LGTM, ready for merge
Projects
None yet
6 participants