-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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 limit control for intersection case of index merge reader #46862
planner: add limit control for intersection case of index merge reader #46862
Conversation
Signed-off-by: AilinKid <314806019@qq.com>
Hi @AilinKid. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #46862 +/- ##
================================================
- Coverage 73.3596% 72.6471% -0.7125%
================================================
Files 1324 1352 +28
Lines 396657 403772 +7115
================================================
+ Hits 290986 293329 +2343
- Misses 87110 91779 +4669
- Partials 18561 18664 +103
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Signed-off-by: AilinKid <314806019@qq.com>
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 for the optimizer part
// give a bias to pushDown limit, since it will get the same cost with NON_PUSH_DOWN_LIMIT case via expect count. | ||
// push down limit case may reduce cop request consumption if any in some cases. | ||
if p.PushedLimit != nil { | ||
p.planCostVer2 = mulCostVer2(p.planCostVer2, 0.99) |
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.
We'd better implement this rule in physical optimization like pushLimitOrTopNForcibly
instead of in the cost model. However the current IndexMerge
implementation prevents us from doing this. Can we add a comment here to notify us to remove this tricky cost formula once we can implement this rule in the physical optimization?
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.
make sense, definitely
Signed-off-by: AilinKid <314806019@qq.com>
/review default |
Potential Problems
Suggestions
ReviewPR TitleThe PR title is clear and indicates what the change is about. PR DescriptionThe PR description is detailed and explains the problem and the solution well. It also provides a link to the related issue and follows the PR Title Format guidelines. The checklist for tests, side effects, documentation, and release notes is also properly filled out. Code ChangesThe code changes seem reasonable and address the problem as described in the issue. There are no obvious issues in the code changes. However, there is a missing feature Test CasesUnit tests are included in the PR, which is good. However, there are no integration tests included. It would be better to add integration tests to ensure the new changes work as expected in the real environment. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
executor/index_merge_reader.go
Outdated
if w.pushedLimit != nil { | ||
if w.pushedLimit.Count == 0 { | ||
// close limitDone channel to notify intersectionProcessWorkers * N to exit. | ||
close(w.limitDone) | ||
return | ||
} | ||
rows := uint64(len(task.handles)) | ||
// The number of handles is less than the offset, discard all handles. | ||
if rows <= w.pushedLimit.Offset { | ||
w.pushedLimit.Offset -= rows | ||
// wait next intersection result task | ||
continue | ||
} | ||
task.handles = task.handles[w.pushedLimit.Offset:] | ||
w.pushedLimit.Offset = 0 | ||
|
||
rows = uint64(len(task.handles)) | ||
// The number of handles is greater than the limit, only keep limit count. | ||
if rows > w.pushedLimit.Count { | ||
task.handles = task.handles[:w.pushedLimit.Count] | ||
} | ||
w.pushedLimit.Count -= mathutil.Min(w.pushedLimit.Count, rows) | ||
} |
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 part could be a single function, and also could be used in fetchLoopUnion
.
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.
make sense, done
Signed-off-by: AilinKid <314806019@qq.com>
Signed-off-by: AilinKid <314806019@qq.com>
/test unit-test |
@AilinKid: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
} | ||
tk.MustExec("analyze table t") | ||
tk.MustExec("insert into t values " + strings.Join(valsInsert, ",")) | ||
for i := 0; i < 100; i++ { |
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.
Maybe 10 is enough, ci is too slow. And better reduce row count to 500.
Signed-off-by: AilinKid <314806019@qq.com>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Defined2014, qw4990 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:
|
@AilinKid: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/test tiprow_fast_test |
@AilinKid: The specified target(s) for
The following commands are available to trigger optional jobs:
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@AilinKid: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
/test tiprow_fast_test |
@AilinKid: The specified target(s) for
The following commands are available to trigger optional jobs:
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What problem does this PR solve?
Issue Number: close #46863
Problem Summary:
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.