Skip to content

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Feb 29, 2024

What problem does this PR solve?

Issue Number: close #51409.

Problem Summary:

What changed and how does it work?

Add TSO and scheduling server to table information_schema.cluster_info.

Check List

Tests

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

After this PR:

mysql> select * from information_schema.cluster_info;
+------------+------------------+------------------+-----------------------------------+------------------------------------------+---------------------+---------------+-----------+
| TYPE       | INSTANCE         | STATUS_ADDRESS   | VERSION                           | GIT_HASH                                 | START_TIME          | UPTIME        | SERVER_ID |
+------------+------------------+------------------+-----------------------------------+------------------------------------------+---------------------+---------------+-----------+
| tidb       | 10.2.8.101:36059 | 10.2.8.101:36983 | 8.0.0-alpha-338-g27ce02afd2-dirty | 27ce02afd2e3d312b2bb92e20489cefce000e320 | 2024-02-29 11:59:21 | 26.651760364s |       996 |
| pd         | 10.2.8.101:41709 | 10.2.8.101:41709 | 8.0.0-alpha-62-gbb65fb4ff         | bb65fb4ff6a33b88436f295e63e326adf67080c5 | 2024-02-29 11:59:00 | 47.651763708s |         0 |
| tikv       | 10.2.8.101:42933 | 10.2.8.101:38331 | 8.0.0-alpha                       | 5cf15aacef1df5af22a29637ee33b742e02ec2da | 2024-02-29 11:59:02 | 45.65176498s  |         0 |
| tikv       | 10.2.8.101:42459 | 10.2.8.101:42117 | 8.0.0-alpha                       | 5cf15aacef1df5af22a29637ee33b742e02ec2da | 2024-02-29 11:59:02 | 45.651767582s |         0 |
| tikv       | 10.2.8.101:38581 | 10.2.8.101:42805 | 8.0.0-alpha                       | 5cf15aacef1df5af22a29637ee33b742e02ec2da | 2024-02-29 11:59:02 | 45.651768495s |         0 |
| tso        | 10.2.8.101:33997 | 10.2.8.101:33997 | 8.0.0-alpha-62-gbb65fb4ff         | bb65fb4ff6a33b88436f295e63e326adf67080c5 | 2024-02-29 11:59:00 | 47.651769258s |         0 |
| scheduling | 10.2.8.101:39917 | 10.2.8.101:39917 | 8.0.0-alpha-62-gbb65fb4ff         | bb65fb4ff6a33b88436f295e63e326adf67080c5 | 2024-02-29 11:59:00 | 47.651770096s |         0 |
+------------+------------------+------------------+-----------------------------------+------------------------------------------+---------------------+---------------+-----------+
7 rows in set (0.01 sec)

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 29, 2024
Copy link

codecov bot commented Feb 29, 2024

Codecov Report

Merging #51410 (7534e81) into master (27ce02a) will increase coverage by 2.0921%.
Report is 42 commits behind head on master.
The diff coverage is 56.5789%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #51410        +/-   ##
================================================
+ Coverage   70.6962%   72.7884%   +2.0921%     
================================================
  Files          1461       1463         +2     
  Lines        434962     444168      +9206     
================================================
+ Hits         307502     323303     +15801     
+ Misses       108243     100599      -7644     
- Partials      19217      20266      +1049     
Flag Coverage Δ
integration 48.9617% <55.2631%> (?)
unit 70.4684% <51.3157%> (-0.0311%) ⬇️

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

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 50.7069% <ø> (+4.8123%) ⬆️

@rleungx rleungx force-pushed the microservice-cluster-info branch 4 times, most recently from 18388ba to d1bf544 Compare February 29, 2024 05:33
@rleungx rleungx force-pushed the microservice-cluster-info branch from d1bf544 to 5946146 Compare February 29, 2024 06:29
@rleungx
Copy link
Member Author

rleungx commented Feb 29, 2024

/test mysql-test

Copy link

tiprow bot commented Feb 29, 2024

@rleungx: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

In response to this:

/test mysql-test

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.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Feb 29, 2024
Comment on lines 236 to 239
// TSOServiceName is the name of TSO service.
TSOServiceName = "tso"
// SchedulingServiceName is the name of scheduling service.
SchedulingServiceName = "scheduling"
Copy link
Member

Choose a reason for hiding this comment

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

Seems no need to be exported.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to add more comments to indicate they are related to PD Micro Services?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

if err != nil {
return nil, errors.Trace(err)
}
// TODO: maybe we should unify the PD API request interface.
Copy link
Member

Choose a reason for hiding this comment

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

We just removed the raw HTTP requests to PD from TiDB, I suggest it would be better to implement it directly by adding interfaces into the PD HTTP client.

Copy link
Member Author

@rleungx rleungx Feb 29, 2024

Choose a reason for hiding this comment

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

Maybe I can send another PR to replace them all.

Signed-off-by: Ryan Leung <[email protected]>
@rleungx rleungx requested review from JmPotato and HuSharp March 4, 2024 07:49
@rleungx
Copy link
Member Author

rleungx commented Mar 4, 2024

/test unit-test

Copy link

tiprow bot commented Mar 4, 2024

@rleungx: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

In response to this:

/test unit-test

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.

return getMicroServiceServerInfo(ctx, schedulingServiceName)
}

func getMicroServiceServerInfo(ctx sessionctx.Context, serviceName string) ([]ServerInfo, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Some of the code in this function and "GetPDServerInfo" have some of the same, do we need to do some simple unification?

Copy link
Member Author

Choose a reason for hiding this comment

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

The decode and response handling are a little bit different.

Copy link
Member Author

Choose a reason for hiding this comment

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

And I just extracted getEtcdMembers here.

Signed-off-by: Ryan Leung <[email protected]>
@rleungx rleungx requested a review from zimulala March 4, 2024 08:36
@rleungx
Copy link
Member Author

rleungx commented Mar 4, 2024

/retest

1 similar comment
@rleungx
Copy link
Member Author

rleungx commented Mar 4, 2024

/retest

Signed-off-by: Ryan Leung <[email protected]>
@rleungx
Copy link
Member Author

rleungx commented Mar 4, 2024

/test check-dev2

Copy link

tiprow bot commented Mar 4, 2024

@rleungx: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

In response to this:

/test check-dev2

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.

Signed-off-by: Ryan Leung <[email protected]>
@ti-chi-bot ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Mar 5, 2024
Copy link

ti-chi-bot bot commented Mar 5, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-02-29 08:05:42.905984516 +0000 UTC m=+1122031.653607625: ☑️ agreed by CabinfeverB.
  • 2024-03-05 03:00:12.457356548 +0000 UTC m=+136039.479602936: ☑️ agreed by zimulala.

Copy link

ti-chi-bot bot commented Mar 5, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CabinfeverB, xhebox, zimulala

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

@rleungx
Copy link
Member Author

rleungx commented Mar 5, 2024

/test fast_test_tiprow

Copy link

ti-chi-bot bot commented Mar 5, 2024

@rleungx: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test build
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pull-br-integration-test
  • /test pull-integration-ddl-test
  • /test pull-lightning-integration-test
  • /test pull-mysql-client-test
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test canary-notify-when-compatibility-sections-changed
  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-integration-nodejs-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test
  • pingcap/tidb/pull_integration_ddl_test
  • pingcap/tidb/pull_mysql_client_test

In response to this:

/test fast_test_tiprow

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.

@ti-chi-bot ti-chi-bot bot merged commit 8597bc3 into pingcap:master Mar 5, 2024
@rleungx rleungx deleted the microservice-cluster-info branch March 5, 2024 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(pdms)add pdms instance info into system table cluster_info
6 participants