-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rditer: replace
ReplicaDataEngineIterator
with `IterateReplicaKeySp…
…ans` This patch replaces `ReplicaDataEngineIterator` with `IterateReplicaKeySpans()`. The Raft snapshot protocol requires an unusual iteration order: for each of the range's key spans, first send all point keys then send all range keys. This allows ingesting SSTs that only span each key span (rather than across wide swaths of the keyspace), with efficient, separate iteration over point/range keys. While the current `ReplicaDataEngineIterator` already does this, the iteration order is rather peculiar, which can be unexpected to users. `IterateReplicaKeySpans` attempts to make this iteration order more explicit. Other approaches were considered but rejected: * Use an iterator generator, which returns the next iterator in the sequence. This was very unergonomic to use, since it required nested iteration loops (one over the iterators, and one per iterator) which make variable naming/reuse and iterator closing awkward. * Use a visitor for each key instead of keyspan. This would again end up hiding the iteration sequence/structure. It also would make it impossible to skip across key spans, or do partial processing of a key span, since it could only abort the entire iteration. Release note: None
- Loading branch information
1 parent
80b5818
commit d789c46
Showing
9 changed files
with
290 additions
and
355 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ go_library( | |
"//pkg/roachpb", | ||
"//pkg/storage", | ||
"//pkg/storage/enginepb", | ||
"//pkg/util/iterutil", | ||
], | ||
) | ||
|
||
|
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
Oops, something went wrong.