-
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 succ filed to slow log and fix shallow copy problem when parse slow log file. #11417
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11417 +/- ##
===========================================
Coverage 81.3926% 81.3926%
===========================================
Files 424 424
Lines 90733 90733
===========================================
Hits 73850 73850
Misses 11585 11585
Partials 5298 5298 |
…into refine-slow-log
How many bytes in query string will cause the shallow copy problem? |
/run-all-tests |
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
@Deardrops When the length of query more than 4094. |
infoschema/slow_log.go
Outdated
case variable.SlowLogSucc: | ||
succ, err := strconv.ParseBool(value) | ||
if err != nil { | ||
return errors.AddStack(err) |
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.
you can use errors.Wrap()
to explain which operation causes this 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.
Great, thanks, Done.
I add errors.Wrap()
outside of this function.
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 it's better to wrap it here? Why delaying it to the outside?
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.
done.
infoschema/slow_log.go
Outdated
@@ -120,14 +120,14 @@ func ParseSlowLog(tz *time.Location, reader *bufio.Reader) ([][]types.Datum, err | |||
} | |||
err = st.setFieldValue(tz, field, fieldValues[i+1]) | |||
if err != nil { | |||
return rows, err | |||
return rows, errors.Wrap(err, "parse slow log filed `"+field+"` 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.
ditto
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
@crazycs520 please follow https://github.com/pingcap/tidb/blob/master/CONTRIBUTING.md to refine the PR title. |
/run-all-tests |
success |
cherry pick to release-2.1 failed |
cherry pick to release-3.0 failed |
… slow log file. (pingcap#11417) Test pass, auto merge by Bot
… slow log file. (pingcap#11417) Test pass, auto merge by Bot
@@ -159,3 +172,17 @@ select * from t;`) | |||
_, err = infoschema.ParseSlowLog(loc, scanner) | |||
c.Assert(err, IsNil) | |||
} | |||
|
|||
func (s *testSuite) TestSlowLogLongQuery(c *C) { |
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.
Sorry, This test is redundant, I will remove this test.
What problem does this PR solve?
Succ
filed name to slow log andSLOW_QUERY
table.SLOW_QUERY
,Query
column type fromvarchar(4096)
tolongtext
.What is changed and how it works?
copy
forgetOneLine
function.Check List
Tests
Code changes
Side effects
Related changes