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: copy session certs when scale-out TiDB #2432

Merged
merged 9 commits into from
Jul 1, 2024

Conversation

djshow832
Copy link
Contributor

@djshow832 djshow832 commented Jun 27, 2024

What problem does this PR solve?

When TiProxy is deployed and then scale out TiDB, the session certs are not copied to the new TiDB instances. Because when judging whether the cluster has TiProxy, the topology is the scale-out spec, not the merged spec.

What is changed and how it works?

  • Split buildSessionCertTasks from buildCertificateTasks. buildCertificateTasks is reverted to that before cluster: auto session certs #2374
  • Pass both the mergedTopo and newPart to buildSessionCertTasks. Generate session certs when TiProxy is newly enabled. Copy session certs to both original and new TiDB instances when scale-out TiDB if TiProxy is deployed.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Case 1:

  1. Deploy a cluster without TiProxy
  2. Scale out TiProxy and check the certs and configs of TiDB
  3. Scale out TiDB and check the certs and configs of TiDB

Case 2:

  1. Deploy a cluster with TiProxy
  2. Scale out TiDB and check the certs and configs of TiDB

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

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

Release notes:

- Fix the bug that after scaling out TiDB, the new TiDB loses signing certs when TiProxy is deployed.

@ti-chi-bot ti-chi-bot bot requested a review from nexustar June 27, 2024 11:16
@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 27, 2024
@djshow832 djshow832 changed the title Scale cert cluster: copy session certs when scale-out TiDB Jun 27, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 86.04651% with 12 lines in your changes missing coverage. Please review.

Project coverage is 50.20%. Comparing base (901a375) to head (8f67aeb).
Report is 3 commits behind head on master.

Current head 8f67aeb differs from pull request most recent head 02fcc84

Please upload reports for the commit 02fcc84 to get more accurate results.

Files Patch % Lines
pkg/cluster/manager/builder.go 87.14% 6 Missing and 3 partials ⚠️
pkg/cluster/manager/deploy.go 40.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2432      +/-   ##
==========================================
- Coverage   55.03%   50.20%   -4.84%     
==========================================
  Files         334      333       -1     
  Lines       35925    35952      +27     
==========================================
- Hits        19771    18047    -1724     
- Misses      13773    15538    +1765     
+ Partials     2381     2367      -14     
Flag Coverage Δ
cluster 44.56% <86.05%> (+0.30%) ⬆️
dm 25.00% <17.44%> (-<0.01%) ⬇️
playground 16.11% <0.00%> (+<0.01%) ⬆️
unittest ?

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 27, 2024
@kaaaaaaang
Copy link
Collaborator

/lgtm

@ti-chi-bot ti-chi-bot bot added the lgtm label Jul 1, 2024
@kaaaaaaang
Copy link
Collaborator

/approve

Copy link
Contributor

ti-chi-bot bot commented Jul 1, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kaaaaaaang

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Jul 1, 2024
@ti-chi-bot ti-chi-bot bot removed the lgtm label Jul 1, 2024
Copy link
Contributor

ti-chi-bot bot commented Jul 1, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-01 02:49:05.163123418 +0000 UTC m=+1206271.648612252: ☑️ agreed by kaaaaaaang.
  • 2024-07-01 07:36:36.157099541 +0000 UTC m=+1223522.642588372: ✖️🔁 reset by ti-chi-bot[bot].

Copy link
Contributor

ti-chi-bot bot commented Jul 1, 2024

New changes are detected. LGTM label has been removed.

@kaaaaaaang kaaaaaaang merged commit b1ee463 into pingcap:master Jul 1, 2024
19 of 20 checks passed
@kaaaaaaang kaaaaaaang added this to the v1.16.0 milestone Jul 1, 2024
@djshow832 djshow832 deleted the scale_cert branch July 1, 2024 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants