-
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
planner: prune cop task for tiflash #13131
planner: prune cop task for tiflash #13131
Conversation
|
…ker/tidb into prune_region_for_tiflash
Codecov Report
@@ Coverage Diff @@
## master #13131 +/- ##
================================================
- Coverage 80.2509% 80.0811% -0.1698%
================================================
Files 469 468 -1
Lines 111823 110890 -933
================================================
- Hits 89739 88802 -937
- Misses 15190 15221 +31
+ Partials 6894 6867 -27 |
@windtalker please add some proper labels for this pr |
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.
In this pr, the cop ranges is enabled for TiFlash to prune cop task
Since it's a full range scan. Which task is pruned now?
@@ -1035,9 +1035,10 @@ func (ds *DataSource) getOriginalPhysicalTableScan(prop *property.PhysicalProper | |||
ts.StoreType = kv.TiKV | |||
} | |||
if ts.StoreType == kv.TiFlash { | |||
// append the AccessCondition to filterCondition because TiFlash only support full range scan for each | |||
// region, do not reset ts.Ranges as it will help prune regions during `buildCopTasks` |
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.
Since it's a full range scan. Which task is pruned before?
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.
For example, for a table t with id as its primary key, and the id is the handle column, if user fire a query like select count(*) from t where id >= 100
, then obviously, only some of the regions have the useful data. For TiKV, TiDB will only send the cop request to these regions, this "task prune" is done by passing range [100, +inf) to the buildCopTask
function. For TiFlash, although it requires full range scan on every region, we can still prune the task which is sending cop request to the regions that do not have data with id >= 100
Co-Authored-By: Yiding Cui <[email protected]>
…ker/tidb into prune_region_for_tiflash
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, will approve when the following comment addressed.
Co-Authored-By: Zhuomin(Charming) Liu <[email protected]>
/run-all-tests |
@windtalker please follow Commit Message and Pull Request Style Commit Message and Pull Request Style to reformat the PR title. |
@windtalker merge failed. |
/run-integration-common-test |
What problem does this PR solve?
prune unnecessary cop task when TiDB query TiFlash
What is changed and how it works?
when pk is handle and the query has filter on the pk column, TiDB use cop ranges to prune the unnecessary cop task, but for TiFlash, since TiFlash does not support scan range in cop task, so current code always use full range to build the cop task. In this pr, the cop ranges is enabled for TiFlash to prune cop task, and in
buildCopTasks
, it will use the full region range when generating TiFlash cop task.Check List
Tests
Side effects