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

store: Add status variables for tikv statistics #22286

Merged
merged 4 commits into from
Mar 10, 2021

Conversation

morgo
Copy link
Contributor

@morgo morgo commented Jan 8, 2021

What problem does this PR solve?

Problem Summary:

In the DBaaS, the table mysql.tidb will be hidden (enforced by Security Enhanced mode, WIP).

This follows on from #21988 and mirrors the tikv statistics in SHOW GLOBAL STATUS. For non-DBaaS installs, the reading from mysql.tidb will continue to be supported (although for consistency between the two, documentation will be updated to point to SHOW GLOBAL STATUS).

What is changed and how it works?

How it Works:

TiDB does not make much use of STATUS variables, but it is the standard way for MySQL to expose various statistics. Here is an example with this added:

mysql> SHOW GLOBAL STATUS;
+-----------------------+------------------------------------------------------------------------------------------+
| Variable_name         | Value                                                                                    |
+-----------------------+------------------------------------------------------------------------------------------+
| Ssl_cipher            |                                                                                          |
| Ssl_cipher_list       |                                                                                          |
| Ssl_verify_mode       | 0                                                                                        |
| Ssl_version           |                                                                                          |
| ddl_schema_version    | 24                                                                                       |
| server_id             | 0d2ce36b-8c20-4610-b95e-488488e1da17                                                     |
| tidb_gc_last_run_time | 20210107-17:13:14 -0700                                                                  |
| tidb_gc_leader_desc   | host:ubuntu, pid:731438, start at 2021-01-07 16:13:14.776532333 -0700 MST m=+4.599786612 |
| tidb_gc_leader_lease  | 20210107-17:15:14 -0700                                                                  |
| tidb_gc_leader_uuid   | 5db7c8098480009                                                                          |
| tidb_gc_safe_point    | 20210107-17:03:14 -0700                                                                  |
+-----------------------+------------------------------------------------------------------------------------------+
11 rows in set (0.01 sec)

mysql> SHOW GLOBAL STATUS LIKE 'tidb_gc_safe_point';
+--------------------+-------------------------+
| Variable_name      | Value                   |
+--------------------+-------------------------+
| tidb_gc_safe_point | 20210107-17:03:14 -0700 |
+--------------------+-------------------------+
1 row in set (0.01 sec)

Related changes

  • Docs will need to be updated

Check List

Tests

  • Unit test

Side effects

  • None (change is backwards compatible)
  • Increased complexity/usability (there is two ways of doing something..)

Release note

  • Garbage collection statistics are now available via the command SHOW GLOBAL STATUS.

Copy link
Contributor

@youjiali1995 youjiali1995 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-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 20, 2021
Copy link
Contributor

@MyonKeminta MyonKeminta 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

m[tidbGCLeaderUUID] = v
}
if v, err := w.loadValueFromSysTable(gcLeaderDescKey); err == nil {
m[tidbGCLeaderDesc] = v
Copy link
Contributor

Choose a reason for hiding this comment

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

The leader desc usually contains the leader node's hostname or IP address. Since mysql.tidb will be hidden for security concern, can this be exposed directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will have to add filtering of SHOW [GLOBAL] STATUS to security enhanced mode. The proposal is closed for now because it was moved out of this sprint. cc @SunRunAway

Moving to SHOW STATUS is still beneficial though, since filtering from here has a cleaner semantic than patching out results from SELECT * FROM mysql.tidb.

Copy link
Contributor

@MyonKeminta MyonKeminta 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

@MyonKeminta: Please use /LGTM instead of LGTM when you want to approve the pull request by comment.
If you use the GitHub review feature, please approve the PR directly, the comment will not take effect in the GitHub review feature.
If you have any qustions please refer to lgtm command help or lgtm plugin design.

If you have approved this PR, please ignore this reply. This reply is being used as a temporary reply during the migration of the new bot and will be removed on April 1.

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
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • MyonKeminta

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 status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 9, 2021
@morgo
Copy link
Contributor Author

morgo commented Mar 10, 2021

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 42e101c

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

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

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 10, 2021
@Rustin170506
Copy link
Member

/run-unit-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/GC size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants