Skip to content

Commit

Permalink
distsql: let analyze use RC level and low priority (#7496)
Browse files Browse the repository at this point in the history
  • Loading branch information
alivxxx authored Aug 27, 2018
1 parent 2d1fae8 commit 1d0d0a6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions distsql/request_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ func (builder *RequestBuilder) SetAnalyzeRequest(ana *tipb.AnalyzeReq) *RequestB
builder.Request.StartTs = ana.StartTs
builder.Request.Data, builder.err = ana.Marshal()
builder.Request.NotFillCache = true
builder.Request.IsolationLevel = kv.RC
builder.Request.Priority = kv.PriorityLow
return builder
}

Expand Down
6 changes: 1 addition & 5 deletions distsql/request_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (

. "github.com/pingcap/check"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/mysql"
"github.com/pingcap/tidb/sessionctx"
"github.com/pingcap/tidb/sessionctx/stmtctx"
"github.com/pingcap/tidb/sessionctx/variable"
Expand Down Expand Up @@ -490,13 +489,10 @@ func (s *testSuite) TestRequestBuilder5(c *C) {
},
}

sv := variable.NewSessionVars()
sv.StmtCtx.Priority = mysql.LowPriority
sv.StmtCtx.NotFillCache = true
actual, err := (&RequestBuilder{}).SetKeyRanges(keyRanges).
SetAnalyzeRequest(&tipb.AnalyzeReq{}).
SetKeepOrder(true).
SetFromSessionVars(sv).
SetConcurrency(15).
Build()
c.Assert(err, IsNil)
expect := &kv.Request{
Expand Down
4 changes: 2 additions & 2 deletions executor/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ func (e *AnalyzeIndexExec) open() error {
kvReq, err := builder.SetIndexRanges(e.ctx.GetSessionVars().StmtCtx, e.physicalTableID, e.idxInfo.ID, ranger.FullRange()).
SetAnalyzeRequest(e.analyzePB).
SetKeepOrder(true).
SetConcurrency(e.concurrency).
Build()
kvReq.Concurrency = e.concurrency
ctx := context.TODO()
e.result, err = distsql.Analyze(ctx, e.ctx.GetClient(), kvReq, e.ctx.GetSessionVars().KVVars)
if err != nil {
Expand Down Expand Up @@ -289,8 +289,8 @@ func (e *AnalyzeColumnsExec) buildResp(ranges []*ranger.Range) (distsql.SelectRe
kvReq, err := builder.SetTableRanges(e.physicalTableID, ranges, nil).
SetAnalyzeRequest(e.analyzePB).
SetKeepOrder(e.keepOrder).
SetConcurrency(e.concurrency).
Build()
kvReq.Concurrency = e.concurrency
if err != nil {
return nil, errors.Trace(err)
}
Expand Down

0 comments on commit 1d0d0a6

Please sign in to comment.