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

*: add region read/write bytes info and approximate size/keys in show table regions result. #11847

Merged
merged 4 commits into from
Aug 29, 2019

Conversation

crazycs520
Copy link
Contributor

@crazycs520 crazycs520 commented Aug 23, 2019

What problem does this PR solve?

  • Add region read/write bytes info and approximate size/keys in show table regions result.

before

test> show table t_wide regions;
+-----------+----------------------------+----------------------------+-----------+-----------------+---------------+------------+
| REGION_ID | START_KEY                  | END_Key                    | LEADER_ID | LEADER_STORE_ID | PEERS         | SCATTERING |
+-----------+----------------------------+----------------------------+-----------+-----------------+---------------+------------+
| 208       | t_49_                      | t_49_r_1152921504606846976 | 211       | 11              | 209, 210, 211 | 0          |
| 212       | t_49_r_1152921504606846976 | t_49_r_2305843009213693952 | 216       | 3               | 215, 217, 216 | 0          |
| 218       | t_49_r_2305843009213693952 | t_49_r_3458764513820540928 | 222       | 1               | 219, 220, 222 | 0          |
| 223       | t_49_r_3458764513820540928 | t_49_r_4611686018427387904 | 227       | 3               | 225, 226, 227 | 0          |
| 228       | t_49_r_4611686018427387904 | t_49_r_5764607523034234880 | 233       | 3               | 233, 232, 283 | 0          |
| 234       | t_49_r_5764607523034234880 | t_49_r_6917529027641081856 | 236       | 10              | 236, 258, 264 | 0          |
| 238       | t_49_r_6917529027641081856 | t_49_r_8070450532247928832 | 267       | 10              | 243, 242, 267 | 0          |
| 5         | t_49_r_8070450532247928832 |                            | 255       | 1               | 96, 255, 256  | 0          |
+-----------+----------------------------+----------------------------+-----------+-----------------+---------------+------------+

In This PR

+-----------+----------------------------+----------------------------+-----------+-----------------+---------------+------------+---------------+------------+------------------+------------------+
| REGION_ID | START_KEY                  | END_KEY                    | LEADER_ID | LEADER_STORE_ID | PEERS         | SCATTERING | WRITTEN_BYTES | READ_BYTES | APPROXIMATE_SIZE(MB) | APPROXIMATE_KEYS |
+-----------+----------------------------+----------------------------+-----------+-----------------+---------------+------------+---------------+------------+------------------+------------------+
| 208       | t_49_                      | t_49_r_1152921504606846976 | 211       | 11              | 209, 210, 211 | 0          | 21955670      | 34808000   | 129              | 109974           |
| 212       | t_49_r_1152921504606846976 | t_49_r_2305843009213693952 | 216       | 3               | 215, 217, 216 | 0          | 18482953      | 40228600   | 59               | 220528           |
| 218       | t_49_r_2305843009213693952 | t_49_r_3458764513820540928 | 222       | 1               | 219, 220, 222 | 0          | 21412156      | 40476040   | 76               | 74187            |
| 223       | t_49_r_3458764513820540928 | t_49_r_4611686018427387904 | 227       | 3               | 225, 226, 227 | 0          | 20311151      | 35104000   | 37               | 30999            |
| 228       | t_49_r_4611686018427387904 | t_49_r_5764607523034234880 | 233       | 3               | 233, 232, 283 | 0          | 0             | 0          | 37               | 78094            |
| 234       | t_49_r_5764607523034234880 | t_49_r_6917529027641081856 | 236       | 10              | 236, 258, 264 | 0          | 0             | 0          | 33               | 36885            |
| 238       | t_49_r_6917529027641081856 | t_49_r_8070450532247928832 | 267       | 10              | 243, 242, 267 | 0          | 0             | 0          | 40               | 51768            |
| 5         | t_49_r_8070450532247928832 |                            | 255       | 1               | 96, 255, 256  | 0          | 0             | 0          | 33               | 33000            |
+-----------+----------------------------+----------------------------+-----------+-----------------+---------------+------------+---------------+------------+------------------+------------------+

Add 4 new field

  • WRITTEN_BYTES: the write bytes in the heartbeat cycle. unit is bytes.
  • READ_BYTES : the read bytes in the heartbeat cycle. unit is bytes.
  • APPROXIMATE_SIZE(MB) : approximate region size. unit is MB.
  • APPROXIMATE_KEYS: approximate region keys.

What is changed and how it works?

Use PD HTTP API /pd/api/v1//region/id/{id} to get region info one by one.

problem

The region info got from PD may not be accurate.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

Related changes

  • Need to cherry-pick to the release branch

Release Note

  • Add more region flow information in show table region result.

@sre-bot
Copy link
Contributor

sre-bot commented Aug 23, 2019

Thanks for your PR.
This PR will be closed by bot because you already had 2 opened PRs, close or merge them before submitting a new one.
#11702 , #11786

@codecov
Copy link

codecov bot commented Aug 27, 2019

Codecov Report

Merging #11847 into master will decrease coverage by 0.1627%.
The diff coverage is 48.7179%.

@@               Coverage Diff                @@
##             master     #11847        +/-   ##
================================================
- Coverage   81.3809%   81.2182%   -0.1628%     
================================================
  Files           438        438                
  Lines         95225      94384       -841     
================================================
- Hits          77495      76657       -838     
- Misses        12246      12249         +3     
+ Partials       5484       5478         -6

HotWrite = "/pd/api/v1/hotspot/regions/write"
Regions = "/pd/api/v1/regions"
Stores = "/pd/api/v1/stores"
HotRead = "/pd/api/v1/hotspot/regions/read"
Copy link
Contributor

Choose a reason for hiding this comment

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

Need update the doc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep. I will do it.

Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

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

LGTM

@crazycs520 crazycs520 reopened this Aug 29, 2019
bb7133
bb7133 previously approved these changes Aug 29, 2019
Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

@bb7133 bb7133 added the status/LGT2 Indicates that a PR has LGTM 2. label Aug 29, 2019
@crazycs520
Copy link
Contributor Author

/run-all-tests

@winkyao
Copy link
Contributor

winkyao commented Aug 29, 2019

Could you change APPROXIMATE_SIZE to APPROXIMATE_SIZE (MB)

Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

Need change

@winkyao
Copy link
Contributor

winkyao commented Aug 29, 2019

/run-all-tests

@winkyao winkyao merged commit ba4eb8f into pingcap:master Aug 29, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Aug 29, 2019

cherry pick to release-2.1 failed

@sre-bot
Copy link
Contributor

sre-bot commented Aug 29, 2019

cherry pick to release-3.0 failed

crazycs520 added a commit to crazycs520/tidb that referenced this pull request Sep 2, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Apr 7, 2020

It seems that, not for sure, we failed to cherry-pick this commit to release-2.1. Please comment '/run-cherry-picker' to try to trigger the cherry-picker if we did fail to cherry-pick this commit before. @crazycs520 PTAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT2 Indicates that a PR has LGTM 2. type/usability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants