Skip to content

Commit

Permalink
executor: set priority for IndexLookupExecutor when reading table (pi…
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao authored and hanfei1991 committed Dec 3, 2017
1 parent 6c68e41 commit 0604183
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions executor/distsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ func (e *IndexLookUpExecutor) buildTableReader(goCtx goctx.Context, handles []in
table: e.table,
tableID: e.tableID,
dagPB: e.tableRequest,
priority: e.priority,
}, handles)
if err != nil {
log.Error(err)
Expand Down
8 changes: 8 additions & 0 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2039,15 +2039,23 @@ func (s *testContextOptionSuite) TestCoprocessorPriority(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
tk.MustExec("create table t (id int primary key)")
tk.MustExec("create table t1 (id int, v int, unique index i_id (id))")
defer tk.MustExec("drop table t")
defer tk.MustExec("drop table t1")
tk.MustExec("insert into t values (1)")

// Insert some data to make sure plan build IndexLookup for t1.
for i := 0; i < 10; i++ {
tk.MustExec(fmt.Sprintf("insert into t1 values (%d, %d)", i, i))
}

cli := s.cli
cli.mu.Lock()
cli.mu.checkFlags = checkRequestPriority
cli.mu.Unlock()
cli.priority = pb.CommandPri_High
tk.MustQuery("select id from t where id = 1")
tk.MustQuery("select * from t1 where id = 1")

cli.priority = pb.CommandPri_Low
tk.MustQuery("select count(*) from t")
Expand Down

0 comments on commit 0604183

Please sign in to comment.