-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
planner: add more test cases for non-prep plan cache #43083
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
@@ -682,7 +682,7 @@ func TestIssue22231(t *testing.T) { | |||
tk.MustExec("create table t_issue_22231(a datetime)") | |||
tk.MustExec("insert into t_issue_22231 values('2020--05-20 01:22:12')") | |||
tk.MustQuery("select * from t_issue_22231 where a >= '2020-05-13 00:00:00 00:00:00' and a <= '2020-05-28 23:59:59 00:00:00'").Check(testkit.Rows("2020-05-20 01:22:12")) | |||
tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1292 Truncated incorrect datetime value: '2020-05-13 00:00:00 00:00:00'", "Warning 1292 Truncated incorrect datetime value: '2020-05-28 23:59:59 00:00:00'")) | |||
tk.MustQuery("show warnings").MultiCheckContain([]string{"Truncated incorrect datetime value: '2020-05-13 00:00:00 00:00:00'", "Truncated incorrect datetime value: '2020-05-28 23:59:59 00:00:00'"}) |
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.
Prepare to enable this switch by default in the future.
param := ast.NewParamMarkerExpr(len(pr.params) - 1) // offset is used as order in non-prepared plan cache. | ||
n.Datum.Copy(¶m.(*driver.ParamMarkerExpr).Datum) // init the ParamMakerExpr's Datum |
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.
Reduce one time of data copy.
planner/core/plan_cache_utils.go
Outdated
dbBytes = hack.Slice(key.stmtText) | ||
bufferSize = len(dbBytes) * 2 |
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.
Reduce times of buffer re-allocation.
planner/core/plan_cache_utils.go
Outdated
dbBytes = hack.Slice(key.database) | ||
bufferSize = len(dbBytes) + 8*6 + 3*8 | ||
dbBytes = hack.Slice(key.stmtText) | ||
bufferSize = len(dbBytes) * 2 | ||
) | ||
if key.hash == nil { | ||
key.hash = make([]byte, 0, bufferSize) |
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 may use sync.Pool
to improve performance.
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.
Yes, I add a TODO comment there.
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 29075d8
|
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 876583e
|
/test mysql-test |
/test all |
1 similar comment
/test all |
/merge |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 1a46daa
|
/test mysql-test |
1 similar comment
/test mysql-test |
/test check-dev2 |
/merge |
/test check-dev2 |
/merge |
/test unit-test |
/test check-dev2 |
1 similar comment
/test check-dev2 |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 95d200c
|
/test check-dev2 |
/test mysql-test |
1 similar comment
/test mysql-test |
/test unit-test |
/test mysql-test |
1 similar comment
/test mysql-test |
/merge |
1 similar comment
/merge |
/test unit-test |
What problem does this PR solve?
Issue Number: ref #36598
Problem Summary: planner: add more test cases for non-prep plan cache
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.