-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
storage: avoid unsplittable range #14654
storage: avoid unsplittable range #14654
Conversation
This needs a test. I'll get to it tomorrow. |
I'm worried about the following situation: we have a large row because there are many versions being written in the past 24 hours for a key. Versions continue to be written second by second, each of which triggers the |
The scenario you describe is likely to create a range that is much larger than 64MB. I'm pretty sure we'll have other more pressing problems than the log spam if we have such a large range. |
2248e55
to
a1ec8a3
Compare
Test added which revealed a problem in |
a1ec8a3
to
73655fd
Compare
The enhancement to |
Reviewed 3 of 6 files at r1, 3 of 3 files at r2. pkg/storage/client_split_test.go, line 2001 at r2 (raw file):
s/Are/Our/ The funkiness is just in this test, right? It would be more natural if we used two actual row keys instead of writing the giant row to the table prefix with no PK values (especially since the table prefix keys are already special for splits) pkg/storage/replica_command.go, line 2634 at r2 (raw file):
Negating this return value feels unnatural to me. pkg/storage/replica_command.go, line 2652 at r2 (raw file):
Swallowing all errors here seems like a bad idea; I think it would be better to either make "no valid splits" a separate error type or make it not an error at all (return pkg/storage/split_queue.go, line 120 at r2 (raw file):
I think that adding some margin here makes sense so we don't re-enqueue the range on every subsequent write. Comments from Reviewable |
1bd876f
to
4eaa8ff
Compare
Review status: 1 of 6 files reviewed at latest revision, 4 unresolved discussions. pkg/storage/client_split_test.go, line 2001 at r2 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Yes, the funkiness is just in this test. Played with this some more and was able to fix it so that we use 3 rows in the same table. pkg/storage/replica_command.go, line 2634 at r2 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Inverted. pkg/storage/replica_command.go, line 2652 at r2 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Done. I've made no valid splits not an error and instead return pkg/storage/split_queue.go, line 120 at r2 (raw file): Previously, bdarnell (Ben Darnell) wrote…
I'm not against doing that, but I don't think it will matter in practice. Changed this to Comments from Reviewable |
Reviewed 2 of 5 files at r3, 3 of 3 files at r4. pkg/storage/client_split_test.go, line 1986 at r4 (raw file):
Remove this. Comments from Reviewable |
If a range cannot be split because a valid split key cannot be found, set the max size for the range to the range's current size. When a range is successfully split, reset the max range size to the zone's max range size. This avoids situations where a range with a single large row cannot be split. Fixes cockroachdb#9555
4eaa8ff
to
dd5797e
Compare
Review status: 2 of 6 files reviewed at latest revision, 5 unresolved discussions. pkg/storage/client_split_test.go, line 1986 at r4 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Done. Comments from Reviewable |
In cockroachdb#14654 we added a mechanism to double the max range size whenever a split attempt found a range that was unsplittable. This prevented a tight loop of split attempts. However, it didn't actually do anything to help us find a split point to reduce the size of the range in the future. This size doubling worked in practice, but it was a blunt instrument that had strange effects (see cockroachdb#24215). This change rips out this range size doubling and replaces it with a split queue purgatory. This purgatory is used to house replicas that are unsplittable, preventing them from getting into a tight loop. Release note: None
In cockroachdb#14654 we added a mechanism to double the max range size whenever a split attempt found a range that was unsplittable. This prevented a tight loop of split attempts. However, it didn't actually do anything to help us find a split point to reduce the size of the range in the future. This size doubling worked in practice, but it was a blunt instrument that had strange effects (see cockroachdb#24215). This change rips out this range size doubling and replaces it with a split queue purgatory. This purgatory is used to house replicas that are unsplittable, preventing them from getting into a tight loop. Release note: None
In cockroachdb#14654 we added a mechanism to double the max range size whenever a split attempt found a range that was unsplittable. This prevented a tight loop of split attempts. However, it didn't actually do anything to help us find a split point to reduce the size of the range in the future. This size doubling worked in practice, but it was a blunt instrument that had strange effects (see cockroachdb#24215). This change rips out this range size doubling and replaces it with a split queue purgatory. This purgatory is used to house replicas that are unsplittable, preventing them from getting into a tight loop. Release note: None
25245: storage: add unsplittable ranges to split queue purgatory r=nvanbenschoten a=nvanbenschoten Fixes #25191. This makes the fix for #24215 trivial. In #14654 we added a mechanism to double the max range size whenever a split attempt found a range that was unsplittable. This prevented a tight loop of split attempts. However, it didn't actually do anything to help us find a split point to reduce the size of the range in the future. This size doubling worked in practice, but it was a blunt instrument that had strange effects (see #24215). This change rips out this range size doubling and replaces it with a split queue purgatory. This purgatory is used to house replicas that are unsplittable, preventing them from getting into a tight loop. Release note: None Co-authored-by: Nathan VanBenschoten <[email protected]>
If a range cannot be split because a valid split key cannot be found,
set the max size for the range to the range's current size. When a range
is successfully split, reset the max range size to the zone's max range
size. This avoids situations where a range with a single large row
cannot be split.
Fixes #9555