-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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 last ru consumption for tidb_last_query_info #49769
Conversation
Signed-off-by: nolouch <nolouch@gmail.com>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #49769 +/- ##
================================================
+ Coverage 70.9391% 71.0126% +0.0735%
================================================
Files 1368 1433 +65
Lines 396705 426472 +29767
================================================
+ Hits 281419 302849 +21430
- Misses 95593 104616 +9023
+ Partials 19693 19007 -686
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest-required |
2 similar comments
/retest-required |
/retest-required |
@@ -2351,23 +2351,6 @@ func runStmt(ctx context.Context, se *session, s sqlexec.Statement) (rs sqlexec. | |||
|
|||
sessVars := se.sessionVars | |||
|
|||
// Record diagnostic information for DML statements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a behavior change. Before this PR, LastQueryInfo
is record even if this function returns error, but after this change, if runStmt
returns error and the returned RecordSet is nil, FinishExecuteStmt
won't be called so LastQueryInfo won't be recorded either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most errors occur during the execution stage, before it records the error of the compile+optimize stage. I think it's reasonable move to here. and you can see the manual test on the issue text. I kill the pd, it can record pd timeout
error during execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @djshow832 is it ok to move to FinishExecuteStmt?
lastRUConsumption = float64(len(sessVars.StmtCtx.OriginalSQL)) | ||
}) | ||
// Keep the previous queryInfo for `show session_states` because the statement needs to encode it. | ||
sessVars.LastQueryInfo = sessionstates.QueryInfo{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another question: is it better that when the statement type is not exec or dml, the lastQueryInfo/LastRUConsumption should be reset instead of just keep unchanged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can keep unchanged.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CabinfeverB, glorv The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
Issue Number: ref #49318
Problem Summary:
What changed and how does it work?
Check List
Tests
with debug version (last query)
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.