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/helper, infoschema: add mem table for tikv store status #10248

Merged
merged 6 commits into from Apr 28, 2019

Conversation

winoros
Copy link
Member

@winoros winoros commented Apr 24, 2019

What problem does this PR solve?

Add a mem table to show the tikv status.

What is changed and how it works?

use pd api to get the information.
The table is shown like below.

MySQL [information_schema]> select * from tikv_store_status;
+----------+----------------+-------------+------------------+-------+------------+----------+-----------+--------------+---------------+--------------+-------------+--------------+---------------+--------------+-------------+---------------------+---------------------+---------------------+
| STORE_ID | ADDRESS        | STORE_STATE | STORE_STATE_NAME | LABEL | VERSION    | CAPACITY | AVAILABLE | LEADER_COUNT | LEADER_WEIGHT | LEADER_SCORE | LEADER_SIZE | REGION_COUNT | REGION_WEIGHT | REGION_SCORE | REGION_SIZE | START_TS            | LAST_HEARTBEAT_TS   | UPTIME              |
+----------+----------------+-------------+------------------+-------+------------+----------+-----------+--------------+---------------+--------------+-------------+--------------+---------------+--------------+-------------+---------------------+---------------------+---------------------+
|        1 | 10.0.1.9:20160 |           0 | Up               | null  | 3.0.0-beta | 110 GiB  | 67 GiB    |          581 |             1 |        50314 |       50314 |         1759 |             1 |       152183 |      152183 | 2019-04-23 19:30:35 | 2019-04-24 14:26:15 | 18h55m40.740697759s |
|        4 | 10.0.1.7:20160 |           0 | Up               | null  | 3.0.0-beta | 110 GiB  | 66 GiB    |          584 |             1 |        51021 |       51021 |         1759 |             1 |       152183 |      152183 | 2019-04-23 19:29:18 | 2019-04-24 14:26:17 | 18h56m59.976541336s |
|        5 | 10.0.1.6:20160 |           0 | Up               | null  | 3.0.0-beta | 110 GiB  | 66 GiB    |          594 |             1 |        50848 |       50848 |         1759 |             1 |       152183 |      152183 | 2019-04-23 19:28:01 | 2019-04-24 14:26:19 | 18h58m18.912681579s |
+----------+----------------+-------------+------------------+-------+------------+----------+-----------+--------------+---------------+--------------+-------------+--------------+---------------+--------------+-------------+---------------------+---------------------+---------------------+
3 rows in set (0.00 sec)

Check List

Tests

  • Unit test
  • Manual test (tested at a cluster and get the result above)

Code changes

  • Has exported function/method change
  • Has exported variable/fields change

Related changes

  • Need to be included in the release note

{"REGION_SIZE", mysql.TypeLonglong, 21, 0, nil, nil},
{"START_TS", mysql.TypeDatetime, 0, 0, nil, nil},
{"LAST_HEARTBEAT_TS", mysql.TypeDatetime, 0, 0, nil, nil},
{"UPTIME", mysql.TypeVarchar, 64, 0, nil, nil},
Copy link
Member Author

@winoros winoros Apr 24, 2019

Choose a reason for hiding this comment

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

uptime should be duration actually. But since mysql's Time type's data range is just [-838 hour, 838 hour]. I think it's not very suitable to use it here.

@winoros winoros requested review from alivxxx, lysu and qw4990 April 24, 2019 06:52
@zhouqiang-cl
Copy link
Contributor

/rebuild
/run-all-tests

@zhouqiang-cl
Copy link
Contributor

/run-all-tests

@zhouqiang-cl
Copy link
Contributor

/run-all-tests

@zz-jason
Copy link
Member

@winoros Please fix the UT.

@qw4990
Copy link
Contributor

qw4990 commented Apr 25, 2019

/run-all-tests

Copy link
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

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

LGTM

alivxxx
alivxxx previously approved these changes Apr 26, 2019
Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

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

LGTM

@alivxxx alivxxx added the status/LGT2 Indicates that a PR has LGTM 2. label Apr 26, 2019
@alivxxx alivxxx dismissed their stale review April 26, 2019 09:44

Please fix CI.

@codecov
Copy link

codecov bot commented Apr 28, 2019

Codecov Report

Merging #10248 into master will decrease coverage by 0.0504%.
The diff coverage is 16.4383%.

@@               Coverage Diff                @@
##             master     #10248        +/-   ##
================================================
- Coverage   77.8232%   77.7727%   -0.0505%     
================================================
  Files           410        410                
  Lines         84372      84446        +74     
================================================
+ Hits          65661      65676        +15     
- Misses        13811      13865        +54     
- Partials       4900       4905         +5

@codecov
Copy link

codecov bot commented Apr 28, 2019

Codecov Report

Merging #10248 into master will decrease coverage by 0.0553%.
The diff coverage is 16.4383%.

@@               Coverage Diff               @@
##            master     #10248        +/-   ##
===============================================
- Coverage   77.941%   77.8856%   -0.0554%     
===============================================
  Files          409        409                
  Lines        83866      83950        +84     
===============================================
+ Hits         65366      65385        +19     
- Misses       13636      13697        +61     
- Partials      4864       4868         +4

@winoros winoros requested a review from alivxxx April 28, 2019 03:50
@winoros
Copy link
Member Author

winoros commented Apr 28, 2019

@lamxTyler fixed

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added Priority/P1 Features that will be implemented in the latest or next major/minor version priority/release-blocker This PR blocks a release. Please review it ASAP. labels Apr 28, 2019
@winoros winoros merged commit 3f89a6e into pingcap:master Apr 28, 2019
@winoros winoros deleted the tikv-status-mem-table branch April 28, 2019 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority/P1 Features that will be implemented in the latest or next major/minor version priority/release-blocker This PR blocks a release. Please review it ASAP. status/LGT2 Indicates that a PR has LGTM 2. type/usability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants