From 6bdd0d712040a114b3a7ae577575f691be1e983c Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Thu, 23 Jun 2022 14:33:35 +0800 Subject: [PATCH 1/3] store/copr: fix tiflash integration test after enable coprocessor paging --- store/copr/coprocessor.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/store/copr/coprocessor.go b/store/copr/coprocessor.go index bef71c20aeb51..57a48f7d6908b 100644 --- a/store/copr/coprocessor.go +++ b/store/copr/coprocessor.go @@ -860,7 +860,9 @@ func (worker *copIteratorWorker) handleCopPagingResult(bo *Backoffer, rpcCtx *ti pagingRange := resp.pbResp.Range // only paging requests need to calculate the next ranges if pagingRange == nil { - return nil, errors.New("lastRange in paging should not be nil") + // If the storage engine doesn't support paging protocol, it should have return all the region data. + // So we finish here. + return nil, nil } // calculate next ranges and grow the paging size task.ranges = worker.calculateRemain(task.ranges, pagingRange, worker.req.Desc) From 65e917fa84aade847997d550df495cbf2c165a0a Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Thu, 23 Jun 2022 15:31:49 +0800 Subject: [PATCH 2/3] address comment --- store/copr/coprocessor.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/store/copr/coprocessor.go b/store/copr/coprocessor.go index 57a48f7d6908b..ad48472176458 100644 --- a/store/copr/coprocessor.go +++ b/store/copr/coprocessor.go @@ -77,9 +77,12 @@ func (c *CopClient) Send(ctx context.Context, req *kv.Request, variables interfa if !ok { return copErrorResponse{errors.Errorf("unsupported variables:%+v", variables)} } - if req.StoreType == kv.TiFlash && req.BatchCop { - logutil.BgLogger().Debug("send batch requests") - return c.sendBatch(ctx, req, vars, option) + if req.StoreType == kv.TiFlash { + if req.BatchCop { + logutil.BgLogger().Debug("send batch requests") + return c.sendBatch(ctx, req, vars, option) + } + req.Paging = false } failpoint.Inject("DisablePaging", func(_ failpoint.Value) { req.Paging = false @@ -860,9 +863,7 @@ func (worker *copIteratorWorker) handleCopPagingResult(bo *Backoffer, rpcCtx *ti pagingRange := resp.pbResp.Range // only paging requests need to calculate the next ranges if pagingRange == nil { - // If the storage engine doesn't support paging protocol, it should have return all the region data. - // So we finish here. - return nil, nil + return nil, errors.New("lastRange in paging should not be nil") } // calculate next ranges and grow the paging size task.ranges = worker.calculateRemain(task.ranges, pagingRange, worker.req.Desc) From 40a5b2a5c4e382a81c0015f071049e9f2c39ac4e Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Fri, 24 Jun 2022 09:21:47 +0800 Subject: [PATCH 3/3] need to fix mocktikv --- store/copr/coprocessor.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/store/copr/coprocessor.go b/store/copr/coprocessor.go index ad48472176458..57a48f7d6908b 100644 --- a/store/copr/coprocessor.go +++ b/store/copr/coprocessor.go @@ -77,12 +77,9 @@ func (c *CopClient) Send(ctx context.Context, req *kv.Request, variables interfa if !ok { return copErrorResponse{errors.Errorf("unsupported variables:%+v", variables)} } - if req.StoreType == kv.TiFlash { - if req.BatchCop { - logutil.BgLogger().Debug("send batch requests") - return c.sendBatch(ctx, req, vars, option) - } - req.Paging = false + if req.StoreType == kv.TiFlash && req.BatchCop { + logutil.BgLogger().Debug("send batch requests") + return c.sendBatch(ctx, req, vars, option) } failpoint.Inject("DisablePaging", func(_ failpoint.Value) { req.Paging = false @@ -863,7 +860,9 @@ func (worker *copIteratorWorker) handleCopPagingResult(bo *Backoffer, rpcCtx *ti pagingRange := resp.pbResp.Range // only paging requests need to calculate the next ranges if pagingRange == nil { - return nil, errors.New("lastRange in paging should not be nil") + // If the storage engine doesn't support paging protocol, it should have return all the region data. + // So we finish here. + return nil, nil } // calculate next ranges and grow the paging size task.ranges = worker.calculateRemain(task.ranges, pagingRange, worker.req.Desc)