Skip to content

Commit

Permalink
distsql: let analyze use RC level and low priority (#7496) (#7500)
Browse files Browse the repository at this point in the history
  • Loading branch information
alivxxx authored and coocood committed Aug 28, 2018
1 parent d19300f commit 2443abc
Show file tree
Hide file tree
Showing 3 changed files with 7 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 @@ -89,6 +89,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: 3 additions & 3 deletions distsql/request_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ func (s *testSuite) TestRequestBuilder5(c *C) {
actual, err := (&RequestBuilder{}).SetKeyRanges(keyRanges).
SetAnalyzeRequest(&tipb.AnalyzeReq{}).
SetKeepOrder(true).
SetPriority(kv.PriorityLow).
SetConcurrency(15).
Build()
c.Assert(err, IsNil)
expect := &kv.Request{
Expand All @@ -506,8 +506,8 @@ func (s *testSuite) TestRequestBuilder5(c *C) {
KeyRanges: keyRanges,
KeepOrder: true,
Desc: false,
Concurrency: 0,
IsolationLevel: kv.SI,
Concurrency: 15,
IsolationLevel: kv.RC,
Priority: 1,
NotFillCache: true,
SyncLog: false,
Expand Down
6 changes: 2 additions & 4 deletions executor/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,8 @@ func (e *AnalyzeIndexExec) open() error {
kvReq, err := builder.SetIndexRanges(e.ctx.GetSessionVars().StmtCtx, e.tblInfo.ID, e.idxInfo.ID, ranger.FullNewRange()).
SetAnalyzeRequest(e.analyzePB).
SetKeepOrder(true).
SetPriority(e.priority).
SetConcurrency(e.concurrency).
Build()
kvReq.Concurrency = e.concurrency
ctx := context.TODO()
e.result, err = distsql.Analyze(ctx, e.ctx.GetClient(), kvReq)
if err != nil {
Expand Down Expand Up @@ -313,9 +312,8 @@ func (e *AnalyzeColumnsExec) buildResp(ranges []*ranger.NewRange) (distsql.Selec
kvReq, err := builder.SetTableRanges(e.tblInfo.ID, ranges, nil).
SetAnalyzeRequest(e.analyzePB).
SetKeepOrder(e.keepOrder).
SetPriority(e.priority).
SetConcurrency(e.concurrency).
Build()
kvReq.Concurrency = e.concurrency
if err != nil {
return nil, errors.Trace(err)
}
Expand Down

0 comments on commit 2443abc

Please sign in to comment.