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) #20430

Merged
merged 4 commits into from
Oct 15, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #19334 to release-4.0


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: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor Author

/run-all-tests

Signed-off-by: crazycs520 <crazycs520@gmail.com>
@crazycs520
Copy link
Contributor

/run-all-tests

Signed-off-by: crazycs520 <crazycs520@gmail.com>
@crazycs520
Copy link
Contributor

/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

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

@tangenta, Thanks for your review, however we are sorry that your vote won't be count.

@ti-srebot
Copy link
Contributor Author

@crazycs520, Thanks for your review, however we are sorry that your vote won't be count.

@crazycs520
Copy link
Contributor

/merge

@ti-srebot
Copy link
Contributor Author

@crazycs520 Oops! This PR requires at least 2 LGTMs to merge. The current number of LGTM is 1

@crazycs520
Copy link
Contributor

/run-all-tests

@SunRunAway SunRunAway merged commit 14d71e0 into pingcap:release-4.0 Oct 15, 2020
@SunRunAway SunRunAway deleted the release-4.0-650be7c4383a branch October 15, 2020 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants