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

execute: add rpc runtime stats information for insert/update/replace statement #19334

Merged
merged 11 commits into from
Aug 24, 2020

Conversation

crazycs520
Copy link
Contributor

@crazycs520 crazycs520 commented Aug 20, 2020

What problem does this PR solve?

related PR: #18056

Add rpc runtime stats for insert/update/replace statement.

here is some example in slow log plan field:

# insert on duplicate key

test> select tidb_decode_plan('ZfBGMAkyN18xCTAJMAlOL0EJMAl0aW1lOjgxOC40OTjCtXMsIGxvb3BzOjEsIEJhdGNoR2V0OntudW1fcnBjOjEsIHRvdGFsX3QBNWQ0ODguMzU5wrVzfQk0MjYgQnl0ZXMJTi9BCg==');
+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_decode_plan('ZfBGMAkyN18xCTAJMAlOL0EJMAl0aW1lOjgxOC40OTjCtXMsIGxvb3BzOjEsIEJhdGNoR2V0OntudW1fcnBjOjEsIHRvdGFsX3QBNWQ0ODguMzU5wrVzfQk0MjYgQnl0ZXMJTi9BCg==') |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|     id          task    estRows    operator info    actRows    execution info                                                           memory       disk        |
|     Insert_1    root    0          N/A              0          time:818.498µs, loops:1, BatchGet:{num_rpc:1, total_time:488.359µs}    426 Bytes    N/A           |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------+


# update

 select tidb_decode_plan('ywHYMAkyOF8yCTAJMAlOL0EJMAl0aW1lOjEuMjM0NDE3bXMsIGxvb3BzOjEsIEdldDp7bnVtX3JwYwEQFHRvdGFsXwUwUDI3OC45ODnCtXN9CTM2MyBCeXRlcwFRfAoxCTM2XzEJMAkxCXRhYmxlOnQxLCBpbmRleDphKGEpARcBcSQ5MTAuMTA4wrVzXnEABDIsLnEATDg3MC4yMTjCtXN9CU4vQQlOL0EK');
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_decode_plan('ywHYMAkyOF8yCTAJMAlOL0EJMAl0aW1lOjEuMjM0NDE3bXMsIGxvb3BzOjEsIEdldDp7bnVtX3JwYwEQFHRvdGFsXwUwUDI3OC45ODnCtXN9CTM2MyBCeXRlcwFRfAoxCTM2XzEJMAkxCXRhYmxlOnQxLCBpbmRleDphKGEpARcBcSQ5MTAuMTA4wrVzXnEABDIsLnEATDg3MC4yMTjCtXN9CU4vQQlOL0EK') |
|                                                                                                                                                                                                                                                          |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|     id               task    estRows    operator info           actRows    execution info                                                      memory       disk                                                                                         |
|     Update_2         root    0          N/A                     0          time:1.234417ms, loops:1, Get:{num_rpc:1, total_time:278.989µs}    363 Bytes    N/A                                                                                           |
|     └─Point_Get_1    root    1          table:t1, index:a(a)    1          time:910.108µs, loops:1, Get:{num_rpc:2, total_time:870.218µs}    N/A          N/A                                                                                            |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

# Insert when tikv restart

test> select tidb_decode_plan('wwHwkDAJMjdfMQkwCTAJTi9BCTAJdGltZTo2LjAxNTg1ODI4NXMsIGxvb3BzOjEsIEJhdGNoR2V0OntudW1fcnBjOjksIHRvdGFsX3RpbWU6NS40OTUwMDI4NTFzfSxyZWdpb25NaXNzX2JhY2tvZmY6e251bTo5LCB0b3RhbF90aW1lOjUxMiBtc30sdGlrdlJQQ18yKwAENywyXwBUNDczIG1zfQk0NjQgQnl0ZXMJTi9BCg==');
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_decode_plan('wwHwkDAJMjdfMQkwCTAJTi9BCTAJdGltZTo2LjAxNTg1ODI4NXMsIGxvb3BzOjEsIEJhdGNoR2V0OntudW1fcnBjOjksIHRvdGFsX3RpbWU6NS40OTUwMDI4NTFzfSxyZWdpb25NaXNzX2JhY2tvZmY6e251bTo5LCB0b3RhbF90aW1lOjUxMiBtc30sdGlrdlJQQ18yKwAENywyXwBUNDczIG1zfQk0NjQgQnl0ZXMJTi |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|     id          task    estRows    operator info    actRows    execution info                                                                                                                                                         memory       disk          |
|     Insert_1    root    0          N/A              0          time:6.015858285s, loops:1, BatchGet:{num_rpc:9, total_time:5.495002851s},regionMiss_backoff:{num:9, total_time:512 ms},tikvRPC_backoff:{num:7, total_time:5473 ms}    464 Bytes    N/A           |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

What is changed and how it works?

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM

Release note

  • Add rpc runtime stats information for insert/update/replace statement.

Signed-off-by: crazycs520 <crazycs520@gmail.com>
Signed-off-by: crazycs520 <crazycs520@gmail.com>
@crazycs520 crazycs520 requested a review from a team as a code owner August 20, 2020 09:05
@crazycs520 crazycs520 requested review from wshwsh12 and removed request for a team August 20, 2020 09:05
Signed-off-by: crazycs520 <crazycs520@gmail.com>
@qw4990 qw4990 self-requested a review August 20, 2020 09:17
@github-actions github-actions bot added the sig/execution SIG execution label Aug 20, 2020
Copy link
Contributor

@tangenta tangenta 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 Aug 24, 2020
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

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Aug 24, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Aug 24, 2020
@crazycs520
Copy link
Contributor Author

/run-all-tests

@crazycs520
Copy link
Contributor Author

/run-all-tests

@crazycs520
Copy link
Contributor Author

/run-check_dev_2

@crazycs520
Copy link
Contributor Author

/run-integration-common-test

@crazycs520
Copy link
Contributor Author

/run-integration-ddl-test

@crazycs520 crazycs520 merged commit 650be7c into pingcap:master Aug 24, 2020
@crazycs520 crazycs520 deleted the dml-runtime-stats branch August 24, 2020 09:54
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Oct 13, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #20430

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

Successfully merging this pull request may close these issues.

4 participants