-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
copr: split copr requests by buckets #32818
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
@youjiali1995: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
f23f8cf
to
dc13c53
Compare
Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
…cket Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
dc13c53
to
ced3b50
Compare
Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
c018d47
to
340d8af
Compare
583f26c
to
374f3a2
Compare
/run-unit-test |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/4f86e6c5052f525f4a87d14c17e8eb669bf8f1d5 |
/run-all-tests |
@@ -180,7 +181,8 @@ func buildCopTasks(bo *Backoffer, cache *RegionCache, ranges *KeyRanges, req *kv | |||
|
|||
rangesLen := ranges.Len() | |||
|
|||
locs, err := cache.SplitKeyRangesByLocations(bo, ranges) | |||
// TODO(youjiali1995): is there any request type that needn't be splitted by buckets? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the split affect some internal work such as br cheksum, data analyze or statistic update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they should be splitted by buckets too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does TiFlash ignore buckets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. TiFlash has implemented server-side streaming by BatchCoprocessor
which splits ranges by segments.
} | ||
|
||
func TestBuildTasksByBuckets(t *testing.T) { | ||
mockClient, cluster, pdClient, err := testutils.NewMockTiKV("", nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use the new mockstore(NewMockStore
) instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, NewMockStore
doesn't export region schedule functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SplitKeyRangesByLocations
and splitKeyRangesByBuckets
share the similar structure because a bucket
is just like a region in region. Is it possible to unify them?
@@ -319,7 +322,6 @@ type copIteratorWorker struct { | |||
|
|||
replicaReadSeed uint32 | |||
|
|||
actionOnExceed *rateLimitAction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it confirmed to be never used in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, but it's not used now.
region tikv.RegionVerID | ||
ranges *KeyRanges | ||
region tikv.RegionVerID | ||
bucketsVer uint64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will it be used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forget it... Now it's used for reducing UpdateBucketsIfNeeded 0b24a84#diff-23eb1043649369d5956b123b173b799ded8c6b7cbf4519bb32cb3caa01928d75R935.
@@ -180,7 +181,8 @@ func buildCopTasks(bo *Backoffer, cache *RegionCache, ranges *KeyRanges, req *kv | |||
|
|||
rangesLen := ranges.Len() | |||
|
|||
locs, err := cache.SplitKeyRangesByLocations(bo, ranges) | |||
// TODO(youjiali1995): is there any request type that needn't be splitted by buckets? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does TiFlash ignore buckets?
23a09eb
to
0b24a84
Compare
Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
0b24a84
to
108221b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
var i int | ||
for ; i < ranges.Len(); i++ { | ||
r := ranges.At(i) | ||
if !(bucket.Contains(r.EndKey) || bytes.Equal(bucket.EndKey, r.EndKey)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not a simple bytes.Compare(r.EndKey, bucket.EndKey) > 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be len(bucket.EndKey) != 0 && bytes.Compare(r.EndKey, bucket.EndKey) > 0
. It's not simpler.
Signed-off-by: youjiali1995 <zlwgx1023@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
This pull request has been accepted and is ready to merge. Commit hash: dc0981c
|
/run-unit-test |
/merge |
/merge |
/run-unit-test |
Signed-off-by: youjiali1995 zlwgx1023@gmail.com
What problem does this PR solve?
Issue Number: close #32968
Problem Summary:
What is changed and how it works?
latestBucketsVersion
in copr reponse is newer than the cached one, update buckets asynchronously.Check List
Tests
Side effects
Documentation
Release note