-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
26 changed files
with
214 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use test; | ||
drop table if exists t; | ||
create table t (a int); | ||
explain select * from t where a < 1; | ||
id count task operator info | ||
TableReader_7 3323.33 root data:Selection_6 | ||
└─Selection_6 3323.33 cop lt(test.t.a, 1) | ||
└─TableScan_5 10000.00 cop table:t, range:[-inf,+inf], keep order:false, stats:pseudo | ||
insert into mysql.opt_rule_blacklist values('predicate_push_down'); | ||
admin reload opt_rule_blacklist; | ||
|
||
explain select * from t where a < 1; | ||
id count task operator info | ||
Selection_5 8000.00 root lt(test.t.a, 1) | ||
└─TableReader_7 10000.00 root data:TableScan_6 | ||
└─TableScan_6 10000.00 cop table:t, range:[-inf,+inf], keep order:false, stats:pseudo | ||
delete from mysql.opt_rule_blacklist where name='predicate_push_down'; | ||
admin reload opt_rule_blacklist; | ||
|
||
explain select * from t where a < 1; | ||
id count task operator info | ||
TableReader_7 3323.33 root data:Selection_6 | ||
└─Selection_6 3323.33 cop lt(test.t.a, 1) | ||
└─TableScan_5 10000.00 cop table:t, range:[-inf,+inf], keep order:false, stats:pseudo | ||
insert into mysql.expr_pushdown_blacklist values('lt'); | ||
admin reload expr_pushdown_blacklist; | ||
|
||
explain select * from t where a < 1; | ||
id count task operator info | ||
Selection_5 8000.00 root lt(test.t.a, 1) | ||
└─TableReader_7 10000.00 root data:TableScan_6 | ||
└─TableScan_6 10000.00 cop table:t, range:[-inf,+inf], keep order:false, stats:pseudo | ||
delete from mysql.expr_pushdown_blacklist where name='lt'; | ||
admin reload expr_pushdown_blacklist; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use test; | ||
drop table if exists t; | ||
create table t (a int); | ||
|
||
explain select * from t where a < 1; | ||
|
||
insert into mysql.opt_rule_blacklist values('predicate_push_down'); | ||
|
||
admin reload opt_rule_blacklist; | ||
|
||
explain select * from t where a < 1; | ||
|
||
delete from mysql.opt_rule_blacklist where name='predicate_push_down'; | ||
|
||
admin reload opt_rule_blacklist; | ||
|
||
explain select * from t where a < 1; | ||
|
||
insert into mysql.expr_pushdown_blacklist values('lt'); | ||
|
||
admin reload expr_pushdown_blacklist; | ||
|
||
explain select * from t where a < 1; | ||
|
||
delete from mysql.expr_pushdown_blacklist where name='lt'; | ||
|
||
admin reload expr_pushdown_blacklist; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2019 PingCAP, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package executor | ||
|
||
import ( | ||
"context" | ||
|
||
plannercore "github.com/pingcap/tidb/planner/core" | ||
"github.com/pingcap/tidb/sessionctx" | ||
"github.com/pingcap/tidb/util/chunk" | ||
"github.com/pingcap/tidb/util/set" | ||
"github.com/pingcap/tidb/util/sqlexec" | ||
) | ||
|
||
// ReloadOptRuleBlacklistExec indicates ReloadOptRuleBlacklist executor. | ||
type ReloadOptRuleBlacklistExec struct { | ||
baseExecutor | ||
} | ||
|
||
// Next implements the Executor Next interface. | ||
func (e *ReloadOptRuleBlacklistExec) Next(ctx context.Context, _ *chunk.Chunk) error { | ||
return LoadOptRuleBlacklist(e.ctx) | ||
} | ||
|
||
// LoadOptRuleBlacklist loads the latest data from table mysql.opt_rule_blacklist. | ||
func LoadOptRuleBlacklist(ctx sessionctx.Context) (err error) { | ||
sql := "select HIGH_PRIORITY name from mysql.opt_rule_blacklist" | ||
rows, _, err := ctx.(sqlexec.RestrictedSQLExecutor).ExecRestrictedSQL(ctx, sql) | ||
if err != nil { | ||
return err | ||
} | ||
newDisabledLogicalRules := set.NewStringSet() | ||
for _, row := range rows { | ||
name := row.GetString(0) | ||
newDisabledLogicalRules.Insert(name) | ||
} | ||
plannercore.DefaultDisabledLogicalRulesList.Store(newDisabledLogicalRules) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,3 +220,7 @@ func (ds *DataSource) buildKeyInfo() { | |
} | ||
} | ||
} | ||
|
||
func (*buildKeySolver) name() string { | ||
return "build_keys" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.