-
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
session: fix log slow log succ field #11867
Conversation
session/tidb.go
Outdated
@@ -214,7 +214,7 @@ func runStmt(ctx context.Context, sctx sessionctx.Context, s sqlexec.Statement) | |||
// If it is not a select statement, we record its slow log here, | |||
// then it could include the transaction commit time. | |||
if rs == nil { | |||
s.(*executor.ExecStmt).LogSlowQuery(se.GetSessionVars().TxnCtx.StartTS, err != nil) | |||
s.(*executor.ExecStmt).LogSlowQuery(se.GetSessionVars().TxnCtx.StartTS, err == nil) |
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.
please add a UT.
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.
It's hard to add UT to test this..., any suggestion?
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.
how about duplicated primary key error?
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.
? To test this problem, we need the slow log
output and get the SQL corresponding slow log, then check the succ
field.
The above method is hard to implement in UT.
Codecov Report
@@ Coverage Diff @@
## master #11867 +/- ##
===============================================
+ Coverage 81.2595% 81.4186% +0.159%
===============================================
Files 438 438
Lines 94635 94993 +358
===============================================
+ Hits 76900 77342 +442
+ Misses 12238 12174 -64
+ Partials 5497 5477 -20 |
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.
LGTM
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.
LGTM
/run-all-tests |
cherry pick to release-2.1 in PR #11886 |
cherry pick to release-3.0 in PR #11887 |
What problem does this PR solve?
The
succ
field in the slow log was wrong when logging slow log for DDL/DML andadmin show slow
.What is changed and how it works?
Check List
Tests
Code changes
Side effects
Related changes
Release note
succ
field in slow log andadmin show low
was wrong.