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)