-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
db: add migration to rewrite atomic compaction units
Add a new format major version FormatSplitUserKeys that guarantees all sstables within the table form their own atomic compaction unit. Previous versions of Pebble (before #1470) and RocksDB allowed keys with identical user keys to be split across multiple tables within a level. This produced a set of files known as an 'atomic compaction unit' that must be compacted together to preserve the LSM invariant. This change adds a new format major version that can't be committed until all such atomic compaction units have been recompacted to ensure that within levels 1-6, all versions of the same user key are within the same sstable. When ratcheting the format major version to FormatSplitUserKeys, Pebble will look for atomic compaction units and schedule compactions, one-at-a-time, to rewrite these multi-file atomic compaction units into multiple single-file atomic compaction units. Before this new format major version is committed, Pebble will also opportunistically schedule compactions to compact these files in the background when no other compactions may be scheduled. A new field on `pebble.Metrics` exposes the count of such files, populated at Open and whenever one of these compactions is attempted. This migration will allow future versions of Pebble to remove code necessary to handle these atomic compaction units. Close #1495.
- Loading branch information
Showing
22 changed files
with
532 additions
and
65 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
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.