forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
123959: kvstorage: speed up scan for range descriptors r=RaduBerinde a=RaduBerinde On startup we currently scan through all `/Local/Range/` keys in order to find the range descriptors. In some cases, there can be a lot of `/Local/Range/Transaction` records so we end up reading through a lot of data. This change switches to using `SeekGE`: - when we encounter a key that has a suffix before `rdsc` like `/Local/Range/foo/prbe`, we seek directly to the corresponding descriptor key `/Local/Range/foo/rdsc`; - when we encounter a key that has a suffix after `rdsc`, we seek beyond all keys for this range, e.g. `/Local/Range/fop/`. Note that inside Pebble, seeks to a key that is very close to the current position are optimized to try to iterate through the next few keys before doing a real seek. So this change should not be very detrimental even when there aren't a lot of keys to skip. Fixes: cockroachdb#109740 Co-authored-by: Radu Berinde <[email protected]>
- Loading branch information
Showing
8 changed files
with
132 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
pkg/kv/kvserver/kvstorage/testdata/assert_overlapping_replica
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Test the handling of an invalid case of overlapping ranges. | ||
|
||
new-replica range-id=1 replica-id=10 k=a ek=c | ||
---- | ||
r1:{a-c} [(n1,s1):10, next=11, gen=0] | ||
|
||
new-replica range-id=2 replica-id=20 k=b ek=d | ||
---- | ||
r2:{b-d} [(n1,s1):20, next=21, gen=0] | ||
|
||
# The initialization process will skip over the range descriptor which is inside | ||
# the first range. | ||
load-and-reconcile | ||
---- | ||
r1/10: r1:{a-c} [(n1,s1):10, next=11, gen=0] | ||
r2/20: uninitialized |