-
Notifications
You must be signed in to change notification settings - Fork 456
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sstable: add (*sstable.Writer).RangeKey{Set,Unset,Delete} methods
Users of `sstable.Writer` other than Pebble itself (e.g. Cockroach) require a means of adding range keys to an sstable that is slightly more flexible than the existing `AddRangeKey` method in the way in which key spans can be added to the table. Specifically, `AddRangeKey` requires that spans be sorted (start / end key ascending, sequence number and key kind descending), in addition to fragmented and coalesced (i.e. multiple suffixes within the same span are coalesced into a single value). Add the `RangeKey{Set,Unset,Delete}` methods on the `sstable.Writer` that allow adding spans in order of start key. These methods have no requirement that the spans be fragmented or coalesced. Instead, the implementation handles the fragmenting of spans as keys are added. A `keyspan.Fragmenter` emits completed spans into a `rangekey.coalescer`, which aggregates the fragments for the same span into a `rangekey.CoalescedSpan`, which can then be used to write the individual `RangeKey{Set,Unset,Delete}` key / value pairs into the rang key block in the sstable. The new `RangeKey{Set,Unset,Delete}` methods have similar semantics to the existing `Set,Delete,DeleteRange,Merge` methods that write the key / value pairs at sequence number zero. In the range key case, these new methods are intended to be used by external callers when preparing sstables for ingestion. Add a data-driven test specific to the new range key methods. These tests are separate to the existing data driven test cases for the `AddRangeKey` method, which has stricter requirements on how keys are added (i.e. already ordered, fragmented and coalesced). Rename `AddInternalRangeKey` to `AddRangeKey` to better match the existing naming of `(*sstable.Writer).Add`. Add new utility methods to the `rangekey` package to aid in encoding range key values. Related to #1339.
- Loading branch information
Showing
6 changed files
with
622 additions
and
37 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
Oops, something went wrong.