diff --git a/store/copr/copr_test/coprocessor_test.go b/store/copr/copr_test/coprocessor_test.go index 584de99b11a75..a54c5048e12cb 100644 --- a/store/copr/copr_test/coprocessor_test.go +++ b/store/copr/copr_test/coprocessor_test.go @@ -144,4 +144,26 @@ func TestBuildCopIteratorWithBatchStoreCopr(t *testing.T) { require.Equal(t, len(tasks), 1) require.Equal(t, len(tasks[0].ToPBBatchTasks()), 3) require.Equal(t, tasks[0].RowCountHint, 14) + + // paging will disable store batch. + req = &kv.Request{ + Tp: kv.ReqTypeDAG, + KeyRanges: kv.NewNonParitionedKeyRanges(copr.BuildKeyRanges("a", "c", "d", "e", "h", "x", "y", "z")), + FixedRowCountHint: []int{1, 1, 3, 3}, + Concurrency: 15, + StoreBatchSize: 3, + Paging: struct { + Enable bool + MinPagingSize uint64 + MaxPagingSize uint64 + }{ + Enable: true, + MinPagingSize: 1, + MaxPagingSize: 1024, + }, + } + it, errRes = copClient.BuildCopIterator(ctx, req, vars, opt) + require.Nil(t, errRes) + tasks = it.GetTasks() + require.Equal(t, len(tasks), 4) } diff --git a/store/copr/coprocessor.go b/store/copr/coprocessor.go index 3bf5cd89104db..a4cea914c3aa9 100644 --- a/store/copr/coprocessor.go +++ b/store/copr/coprocessor.go @@ -140,6 +140,10 @@ func (c *CopClient) BuildCopIterator(ctx context.Context, req *kv.Request, vars // disable batch copr for follower read req.StoreBatchSize = 0 } + // disable paging for batch copr + if req.Paging.Enable { + req.StoreBatchSize = 0 + } bo := backoff.NewBackofferWithVars(ctx, copBuildTaskMaxBackoff, vars) var (