Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

store/copr: disable batch store copr when paging is enabled #39580

Merged
merged 2 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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