Skip to content

Commit

Permalink
disable batch store copr when paging is enabled
Browse files Browse the repository at this point in the history
Signed-off-by: you06 <you1474600@gmail.com>
  • Loading branch information
you06 committed Dec 2, 2022
1 parent eed9ceb commit 33aef61
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
22 changes: 22 additions & 0 deletions store/copr/copr_test/coprocessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
4 changes: 4 additions & 0 deletions store/copr/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 33aef61

Please sign in to comment.