Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sstable: add range key support to BlockIntervalCollector
Currently, the `sstable.BlockIntervalCollector` exists as a helper struct to which an implementation of `sstable.DataBlockIntervalCollector` is passed. The latter contains the user-defined logic for converting a key and value in an associated interval that can be maintained. The `BlockIntervalCollector` struct handles the logic required to implement `sstable.BlockPropertyCollector`, encoding the interval as a property when the data block is completed, and maintaining index-block- and table-level intervals. Update `sstable.Writer` to pass through range keys to each block property collector as they are added to the writer. As range and point keys can be thought of as existing in separate keyspaces within the same LSM, range keys only contribute to table level intervals (unioned with the point key interval), rather than block- and index-level intervals. Another way to rationalize this decision is to consider that range keys are contained in a single, dedicated block in the SSTable, while the point keys can span multiple blocks and have an associated index entry into which the properties for the specific block are encoded. Block level filtering applies to point keys only, whereas table-level filtering takes the union of the point and range key intervals for the table. One downside of taking the union of the range and point keys for the table level interval is an increased rate of false positives when filtering tables based on an interval and the range key interval is wider than the point key interval. This change alters the `NewBlockIntervalCollector` function to take in two `DataBlockIntervalCollector`s, one for point and range keys. This is required to track the intervals separately within the `BlockIntervalCollector`. The caller has the flexibility of passing in `nil` for one (or both) of the collectors, in which case either point or range keys (or both) will be ignored by the collector. This can be used, for example, to construct a collectors that apply exclusively to either point or range keys.
- Loading branch information