Repository navigation
Allow periodic compaction for non-block-based table formats (#15782) - #15782
Open
joshkang97 wants to merge 1 commit into
Open
joshkang97 wants to merge 1 commit into
joshkang97 wants to merge 1 commit into
Conversation
|
@joshkang97 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D134432323. |
✅ clang-tidy: No findings on changed linesCompleted in 121.6s. |
joshkang97
added a commit
to joshkang97/rocksdb
that referenced
this pull request
Nov 25, 2026
Summary: Pull Request resolved: meta#15782 ## Summary `periodic_compaction_seconds` makes RocksDB compact files once they reach a given age, mainly so that compaction filters eventually see data in files that would otherwise never be compacted again. `ColumnFamilyData::ValidateOptions()` rejects any explicit non-zero value unless the table factory is the block-based table, so `DB::Open()` fails with `NotSupported` for every other table format, including custom table factories. Separately, `SanitizeOptions()` applies the 30-day default (universal compaction, or leveled compaction with a compaction filter) only to block-based tables. Other formats therefore have no way to get periodic compaction at all. The restriction dates from when periodic compaction was added in RocksDB 6.2 (meta#5166). It aged files by a new `file_creation_time` table property, which only the block-based table builder writes; other formats had only the file's modification time, which resets when a file is copied. RocksDB 6.6 started recording file times in the MANIFEST, but the table format check was not revisited. The restriction is no longer needed. `VersionStorageInfo::ComputeFilesMarkedForPeriodicCompaction()` ages a file by its `file_creation_time`, then `oldest_ancestor_time`, which flush and compaction record in the MANIFEST for every output file whatever the table format. It falls back to the table property and then to the file's modification time. The periodic compaction pickers do not depend on the table format either. This change drops the block-based-only validation of `periodic_compaction_seconds`, so an explicit value now works with any table format. The default is unchanged and still applies only to block-based tables, so users of other formats see no new compactions unless they opt in. In those formats, a file with no MANIFEST time, such as one written before 6.6, is aged by its modification time, so it may be compacted late but never early. `ttl` keeps its block-based-only validation. Bonus: db_stress no longer rejects `--periodic_compaction_seconds` with a non-block-based `--table_factory_uri`. Differential Revision: D134432323
joshkang97
force-pushed
the
export-D134432323
branch
from
November 25, 2026 06:15
837464d to
19cdac9
Compare
joshkang97
added a commit
to joshkang97/rocksdb
that referenced
this pull request
Nov 25, 2026
Summary: Pull Request resolved: meta#15782 ## Summary `periodic_compaction_seconds` was limited to block-based tables when it was added in RocksDB 6.2 (meta#5166), because file age came from the `file_creation_time` table property, which only the block-based table builder writes. Since RocksDB 6.6, flush and compaction record `file_creation_time` and `oldest_ancester_time` in the MANIFEST for every output file, and `VersionStorageInfo::ComputeFilesMarkedForPeriodicCompaction()` prefers those, so file selection no longer depends on the table format. `ColumnFamilyData::ValidateOptions()` still rejected an explicit value for any other table factory, so `DB::Open()` failed with `NotSupported`. This change removes that check, so an explicit `periodic_compaction_seconds` works with any table format. The 30-day default still applies only to block-based tables, so other formats see no new compactions unless they set the option. In those formats, a file with no MANIFEST time, such as one written before 6.6, falls back to its modification time, so it may be compacted late but never early. `ttl` keeps its block-based-only check. Bonus: db_stress no longer rejects `--periodic_compaction_seconds` with a non-block-based `--table_factory_uri`. Differential Revision: D134432323
joshkang97
force-pushed
the
export-D134432323
branch
2 times, most recently
from
November 27, 2026 12:10
5d95863 to
a313ad0
Compare
joshkang97
added a commit
to joshkang97/rocksdb
that referenced
this pull request
Nov 27, 2026
Summary: Pull Request resolved: meta#15782 ## Summary `periodic_compaction_seconds` was limited to block-based tables when it was added in RocksDB 6.2 (meta#5166), because file age came from the `file_creation_time` table property, which only the block-based table builder writes. Since RocksDB 6.6, flush and compaction record `file_creation_time` and `oldest_ancester_time` in the MANIFEST for every output file, and `VersionStorageInfo::ComputeFilesMarkedForPeriodicCompaction()` prefers those, so file selection no longer depends on the table format. `ColumnFamilyData::ValidateOptions()` still rejected an explicit value for any other table factory, so `DB::Open()` failed with `NotSupported`. This change removes that check, so an explicit `periodic_compaction_seconds` works with any table format. The 30-day default still applies only to block-based tables, so other formats see no new compactions unless they set the option. In those formats, a file with no MANIFEST time, such as one written before 6.6, falls back to its modification time, so it may be compacted late but never early. `ttl` keeps its block-based-only check. Bonus: db_stress no longer rejects `--periodic_compaction_seconds` with a non-block-based `--table_factory_uri`. Differential Revision: D134432323
Summary: Pull Request resolved: meta#15782 ## Summary `periodic_compaction_seconds` was limited to block-based tables when it was added in RocksDB 6.2 (meta#5166), because file age came from the `file_creation_time` table property, which only the block-based table builder writes. Since RocksDB 6.6, flush and compaction record `file_creation_time` and `oldest_ancester_time` in the MANIFEST for every output file, and `VersionStorageInfo::ComputeFilesMarkedForPeriodicCompaction()` prefers those, so file selection no longer depends on the table format. `ColumnFamilyData::ValidateOptions()` still rejected an explicit value for any other table factory, so `DB::Open()` failed with `NotSupported`. This change removes that check, so an explicit `periodic_compaction_seconds` works with any table format. The 30-day default still applies only to block-based tables, so other formats see no new compactions unless they set the option. In those formats, a file with no MANIFEST time, such as one written before 6.6, falls back to its modification time, so it may be compacted late but never early. `ttl` keeps its block-based-only check. Bonus: db_stress no longer rejects `--periodic_compaction_seconds` with a non-block-based `--table_factory_uri`. Differential Revision: D134432323
joshkang97
force-pushed
the
export-D134432323
branch
from
November 30, 2026 15:41
a313ad0 to
0428a57
Compare
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Summary
periodic_compaction_secondswas limited to block-based tables when it was added in RocksDB 6.2 (#5166), because file age came from thefile_creation_timetable property, which only the block-based table builder writes. Since RocksDB 6.6, flush and compaction recordfile_creation_timeandoldest_ancester_timein the MANIFEST for every output file, andVersionStorageInfo::ComputeFilesMarkedForPeriodicCompaction()prefers those, so file selection no longer depends on the table format.ColumnFamilyData::ValidateOptions()still rejected an explicit value for any other table factory, soDB::Open()failed withNotSupported.This change removes that check, so an explicit
periodic_compaction_secondsworks with any table format. The 30-day default still applies only to block-based tables, so other formats see no new compactions unless they set the option. In those formats, a file with no MANIFEST time, such as one written before 6.6, falls back to its modification time, so it may be compacted late but never early.ttlkeeps its block-based-only check. Bonus: db_stress no longer rejects--periodic_compaction_secondswith a non-block-based--table_factory_uri.Differential Revision: D134432323