-
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
expression: support disable expression pushdown based on store type #16389
Conversation
Codecov Report
@@ Coverage Diff @@
## master #16389 +/- ##
================================================
- Coverage 80.6470% 80.3864% -0.2606%
================================================
Files 506 506
Lines 137643 136666 -977
================================================
- Hits 111005 109861 -1144
- Misses 18096 18228 +132
- Partials 8542 8577 +35 |
} | ||
storeTypes := strings.Split(storeTypeString, ",") | ||
for _, typeString := range storeTypes { | ||
if typeString == "tidb" { |
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 can use the kv.TiDB.Name()
instead of "tidb"
.
|
||
func upgradeToVer42(s Session) { | ||
doReentrantDDL(s, "ALTER TABLE mysql.expr_pushdown_blacklist ADD COLUMN `store_type` char(100) NOT NULL DEFAULT 'tikv,tiflash,tidb'", infoschema.ErrColumnExists) | ||
doReentrantDDL(s, "ALTER TABLE mysql.expr_pushdown_blacklist ADD COLUMN `reason` varchar(200)", infoschema.ErrColumnExists) |
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.
Do we really need this column?
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 prefer to keep this column, since we will add some default rows in expr_pushdown_blacklist
, this column can make it self-explained, otherwise, the users may keep asking why those exprs are disabled by default.
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 prefer to keep this column, since we will add some default rows in
expr_pushdown_blacklist
, this column can make it self-explained, otherwise, the users may keep asking why those exprs are disabled by default.
Yeah, this explanation is also OK for me.
…/tidb into refine_expr_blacklist
expression/integration_test.go
Outdated
"Selection_5 2133.33 root lt(test.t.b, 1994-01-01)", | ||
"└─Selection_9 2666.67 root gt(cast(test.t.a), 10.10)", | ||
" └─TableReader_8 2666.67 root data:Selection_7", | ||
" └─Selection_7 2666.67 cop[tiflash] eq(date_format(test.t.b, \"%m\"), \"11\"), gt(test.t.b, 1988-01-01)", | ||
" └─TableFullScan_6 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo")) |
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 not to compare the explain
result directly. That is not friendly enough for other developers. You can get the testkit.rows
and compare the expression info in the second-to-last row.
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 other changes.
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-integration-copr-test |
"HashJoin_7 9990.00 root inner join, equal:[eq(test.t.a, test.t.a)]", | ||
"├─Selection_15(Build) 7992.00 root from_unixtime(cast(test.t.b))", | ||
"│ └─TableReader_14 7992.00 root data:Selection_13", | ||
"│ └─Selection_13 7992.00 cop[tikv] not(isnull(test.t.a))", |
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.
why the estimated output row count is changed from 9990.00
to 7992.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.
I think this is because from_unixtime
is now pushed down by predicate pushdown rule, so when estimate output rowcount, the cop task thought it has two filter conditions(is not null
and from_unixtime
)
This reverts commit 1128fce.
/run-integration-copr-test |
/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
/merge |
/run-all-tests |
@windtalker merge failed. |
Signed-off-by: sre-bot <[email protected]>
cherry pick to release-3.1 in PR #16513 |
cherry pick to release-4.0 in PR #16514 |
This reverts commit 20f30db.
What problem does this PR solve?
Issue Number: close #16353, close #16504
Problem Summary:
TiDB support expr pushdown blacklist, if the expr is added to mysql.expr_pushdown_blacklist, then it will not be pushed to cop layer, however, this blacklist does not take store type into acount, so it is impossible to disable an expr pushdown to a specified store(like tikv or tiflash)
What is changed and how it works?
What's Changed:
Add two columns
store_type
andreason
tomysql.expr_pushdown_blacklist
How it Works:
store_type
inmysql.expr_pushdown_blacklist
indicates which store should the expr pushdown be disabledCheck List
Tests
Release note