Skip to content

Commit

Permalink
executor,distsql: clean up useless interface (pingcap#23885)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhebox authored Apr 9, 2021
1 parent 69675ea commit 2ea64b2
Show file tree
Hide file tree
Showing 15 changed files with 3 additions and 38 deletions.
1 change: 0 additions & 1 deletion ddl/reorg.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ func (dc *ddlCtx) buildDescTableScan(ctx context.Context, startTS uint64, tbl ta
if err != nil {
return nil, errors.Trace(err)
}
result.Fetch(ctx)
return result, nil
}

Expand Down
14 changes: 0 additions & 14 deletions distsql/distsql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ func (s *testSuite) createSelectNormal(batch, totalRows int, c *C, planIDs []int

func (s *testSuite) TestSelectNormal(c *C) {
response, colTypes := s.createSelectNormal(1, 2, c, nil)
response.Fetch(context.TODO())

// Test Next.
chk := chunk.New(colTypes, 32, 32)
Expand All @@ -108,7 +107,6 @@ func (s *testSuite) TestSelectNormal(c *C) {

func (s *testSuite) TestSelectMemTracker(c *C) {
response, colTypes := s.createSelectNormal(2, 6, c, nil)
response.Fetch(context.TODO())

// Test Next.
chk := chunk.New(colTypes, 3, 3)
Expand All @@ -123,7 +121,6 @@ func (s *testSuite) TestSelectMemTracker(c *C) {
func (s *testSuite) TestSelectNormalChunkSize(c *C) {
s.sctx.GetSessionVars().EnableChunkRPC = false
response, colTypes := s.createSelectNormal(100, 1000000, c, nil)
response.Fetch(context.TODO())
s.testChunkSize(response, colTypes, c)
c.Assert(response.Close(), IsNil)
c.Assert(response.memTracker.BytesConsumed(), Equals, int64(0))
Expand All @@ -141,8 +138,6 @@ func (s *testSuite) TestSelectWithRuntimeStats(c *C) {
}
}

response.Fetch(context.TODO())

// Test Next.
chk := chunk.New(colTypes, 32, 32)
numAllRows := 0
Expand Down Expand Up @@ -247,7 +242,6 @@ func (s *testSuite) createSelectStreaming(batch, totalRows int, c *C) (*streamRe

func (s *testSuite) TestSelectStreaming(c *C) {
response, colTypes := s.createSelectStreaming(1, 2, c)
response.Fetch(context.TODO())

// Test Next.
chk := chunk.New(colTypes, 32, 32)
Expand All @@ -267,15 +261,13 @@ func (s *testSuite) TestSelectStreaming(c *C) {

func (s *testSuite) TestSelectStreamingWithNextRaw(c *C) {
response, _ := s.createSelectStreaming(1, 2, c)
response.Fetch(context.TODO())
data, err := response.NextRaw(context.TODO())
c.Assert(err, IsNil)
c.Assert(len(data), Equals, 16)
}

func (s *testSuite) TestSelectStreamingChunkSize(c *C) {
response, colTypes := s.createSelectStreaming(100, 1000000, c)
response.Fetch(context.TODO())
s.testChunkSize(response, colTypes, c)
c.Assert(response.Close(), IsNil)
}
Expand Down Expand Up @@ -343,8 +335,6 @@ func (s *testSuite) TestAnalyze(c *C) {
c.Assert(result.label, Equals, "analyze")
c.Assert(result.sqlType, Equals, "internal")

response.Fetch(context.TODO())

bytes, err := response.NextRaw(context.TODO())
c.Assert(err, IsNil)
c.Assert(len(bytes), Equals, 16)
Expand All @@ -368,8 +358,6 @@ func (s *testSuite) TestChecksum(c *C) {
c.Assert(result.label, Equals, "checksum")
c.Assert(result.sqlType, Equals, "general")

response.Fetch(context.TODO())

bytes, err := response.NextRaw(context.TODO())
c.Assert(err, IsNil)
c.Assert(len(bytes), Equals, 16)
Expand Down Expand Up @@ -519,7 +507,6 @@ func BenchmarkSelectResponseChunk_BigResponse(b *testing.B) {
s.sctx.GetSessionVars().InitChunkSize = 32
s.sctx.GetSessionVars().MaxChunkSize = 1024
selectResult, colTypes := createSelectNormal(4000, 20000, s.sctx)
selectResult.Fetch(context.TODO())
chk := chunk.NewChunkWithCapacity(colTypes, 1024)
b.StartTimer()
for {
Expand All @@ -544,7 +531,6 @@ func BenchmarkSelectResponseChunk_SmallResponse(b *testing.B) {
s.sctx.GetSessionVars().InitChunkSize = 32
s.sctx.GetSessionVars().MaxChunkSize = 1024
selectResult, colTypes := createSelectNormal(32, 3200, s.sctx)
selectResult.Fetch(context.TODO())
chk := chunk.NewChunkWithCapacity(colTypes, 1024)
b.StartTimer()
for {
Expand Down
5 changes: 0 additions & 5 deletions distsql/select_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ var (

// SelectResult is an iterator of coprocessor partial results.
type SelectResult interface {
// Fetch fetches partial results from client.
Fetch(context.Context)
// NextRaw gets the next raw result.
NextRaw(context.Context) ([]byte, error)
// Next reads the data into chunk.
Expand Down Expand Up @@ -103,9 +101,6 @@ type selectResult struct {
stats *selectResultRuntimeStats
}

func (r *selectResult) Fetch(ctx context.Context) {
}

func (r *selectResult) fetchResp(ctx context.Context) error {
defer func() {
if r.stats != nil {
Expand Down
2 changes: 0 additions & 2 deletions distsql/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ type streamResult struct {
durationReported bool
}

func (r *streamResult) Fetch(context.Context) {}

func (r *streamResult) Next(ctx context.Context, chk *chunk.Chunk) error {
chk.Reset()
for !chk.IsFull() {
Expand Down
3 changes: 0 additions & 3 deletions executor/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ func (e *CheckIndexRangeExec) Open(ctx context.Context) error {
if err != nil {
return err
}
e.result.Fetch(ctx)
return nil
}

Expand Down Expand Up @@ -285,7 +284,6 @@ func (e *RecoverIndexExec) buildTableScan(ctx context.Context, txn kv.Transactio
if err != nil {
return nil, err
}
result.Fetch(ctx)
return result, nil
}

Expand Down Expand Up @@ -748,7 +746,6 @@ func (e *CleanupIndexExec) buildIndexScan(ctx context.Context, txn kv.Transactio
if err != nil {
return nil, err
}
result.Fetch(ctx)
return result, nil
}

Expand Down
2 changes: 0 additions & 2 deletions executor/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ func (e *AnalyzeIndexExec) fetchAnalyzeResult(ranges []*ranger.Range, isNullRang
if err != nil {
return err
}
result.Fetch(ctx)
if isNullRange {
e.countNullRes = result
} else {
Expand Down Expand Up @@ -626,7 +625,6 @@ func (e *AnalyzeColumnsExec) buildResp(ranges []*ranger.Range) (distsql.SelectRe
if err != nil {
return nil, err
}
result.Fetch(ctx)
return result, nil
}

Expand Down
1 change: 0 additions & 1 deletion executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3431,7 +3431,6 @@ func (builder *dataReaderBuilder) buildTableReaderBase(ctx context.Context, e *T
if err != nil {
return nil, err
}
result.Fetch(ctx)
e.resultHandler.open(nil, result)
return e, nil
}
Expand Down
1 change: 0 additions & 1 deletion executor/checksum.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ func (e *ChecksumTableExec) handleChecksumRequest(req *kv.Request) (resp *tipb.C
if err != nil {
return nil, err
}
res.Fetch(ctx)
defer func() {
if err1 := res.Close(); err1 != nil {
err = err1
Expand Down
2 changes: 0 additions & 2 deletions executor/distsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ func (e *IndexReaderExecutor) open(ctx context.Context, kvRanges []kv.KeyRange)
e.feedback.Invalidate()
return err
}
e.result.Fetch(ctx)
return nil
}

Expand Down Expand Up @@ -479,7 +478,6 @@ func (e *IndexLookUpExecutor) startIndexWorker(ctx context.Context, kvRanges []k
if err != nil {
return err
}
result.Fetch(ctx)
worker := &indexWorker{
idxLookup: e,
workCh: workCh,
Expand Down
1 change: 0 additions & 1 deletion executor/index_merge_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ func (e *IndexMergeReaderExecutor) startPartialIndexWorker(ctx context.Context,
return err
}

result.Fetch(ctx)
worker := &partialIndexWorker{
stats: e.stats,
idxID: e.getPartitalPlanID(workID),
Expand Down
1 change: 0 additions & 1 deletion executor/mpp_gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ func (e *MPPGather) Open(ctx context.Context) (err error) {
if err != nil {
return errors.Trace(err)
}
e.respIter.Fetch(ctx)
return nil
}

Expand Down
1 change: 0 additions & 1 deletion executor/table_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ func (e *TableReaderExecutor) buildResp(ctx context.Context, ranges []*ranger.Ra
if err != nil {
return nil, err
}
result.Fetch(ctx)
return result, nil
}

Expand Down
1 change: 0 additions & 1 deletion executor/table_readers_required_rows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type requiredRowsSelectResult struct {
numNextCalled int
}

func (r *requiredRowsSelectResult) Fetch(context.Context) {}
func (r *requiredRowsSelectResult) NextRaw(context.Context) ([]byte, error) { return nil, nil }
func (r *requiredRowsSelectResult) Close() error { return nil }

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ require (
github.com/opentracing/opentracing-go v1.1.0
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/pingcap/badger v1.5.1-0.20200908111422-2e78ee155d19
github.com/pingcap/br v5.0.0-nightly.0.20210329063924-86407e1a7324+incompatible
github.com/pingcap/br v5.0.0-nightly.0.20210407061032-be5523713acf+incompatible
github.com/pingcap/check v0.0.0-20200212061837-5e12011dc712
github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3
github.com/pingcap/failpoint v0.0.0-20210316064728-7acb0f0a3dfd
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ github.com/phf/go-queue v0.0.0-20170504031614-9abe38d0371d h1:U+PMnTlV2tu7RuMK5e
github.com/phf/go-queue v0.0.0-20170504031614-9abe38d0371d/go.mod h1:lXfE4PvvTW5xOjO6Mba8zDPyw8M93B6AQ7frTGnMlA8=
github.com/pingcap/badger v1.5.1-0.20200908111422-2e78ee155d19 h1:IXpGy7y9HyoShAFmzW2OPF0xCA5EOoSTyZHwsgYk9Ro=
github.com/pingcap/badger v1.5.1-0.20200908111422-2e78ee155d19/go.mod h1:LyrqUOHZrUDf9oGi1yoz1+qw9ckSIhQb5eMa1acOLNQ=
github.com/pingcap/br v5.0.0-nightly.0.20210329063924-86407e1a7324+incompatible h1:jvboV3W5zD0N4zyVzqBvGOzb/6MxUW1SIT8hw51Fgko=
github.com/pingcap/br v5.0.0-nightly.0.20210329063924-86407e1a7324+incompatible/go.mod h1:ymVmo50lQydxib0tmK5hHk4oteB7hZ0IMCArunwy3UQ=
github.com/pingcap/br v5.0.0-nightly.0.20210407061032-be5523713acf+incompatible h1:pkfMiswYXWh4W8ehyOTQxaxQzSvP8NCeVfc2LxmQAAg=
github.com/pingcap/br v5.0.0-nightly.0.20210407061032-be5523713acf+incompatible/go.mod h1:ymVmo50lQydxib0tmK5hHk4oteB7hZ0IMCArunwy3UQ=
github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8/go.mod h1:B1+S9LNcuMyLH/4HMTViQOJevkGiik3wW2AN9zb2fNQ=
github.com/pingcap/check v0.0.0-20191107115940-caf2b9e6ccf4/go.mod h1:PYMCGwN0JHjoqGr3HrZoD+b8Tgx8bKnArhSq8YVzUMc=
github.com/pingcap/check v0.0.0-20191216031241-8a5a85928f12/go.mod h1:PYMCGwN0JHjoqGr3HrZoD+b8Tgx8bKnArhSq8YVzUMc=
Expand Down

0 comments on commit 2ea64b2

Please sign in to comment.