-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify usage for options ttl
and periodic_compaction_seconds
for universal compaction
#11552
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
if (result.periodic_compaction_seconds == kDefaultPeriodicCompSecs && | ||
is_block_based_table) { | ||
result.periodic_compaction_seconds = kAdjustedPeriodicCompSecs; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change (enabling regardless of compaction filter in universal) makes sense to me
if (result.periodic_compaction_seconds == kDefaultPeriodicCompSecs && | ||
is_block_based_table) { | ||
result.periodic_compaction_seconds = kAdjustedPeriodicCompSecs; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we should reset result.periodic_compaction_seconds = 0
in case it has a default value and the condition for kAdjustedPeriodicCompSecs
is not satisfied (i.e., !is_block_based_table
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's reset to 0 below in lines 427-429, which resets for all compaction styles.
// Leveled: files older than `periodic_compaction_seconds` will be picked up | ||
// for compaction and will be re-written to the same level as they were | ||
// before. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only bottom-level files, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually for all levels.
include/rocksdb/advanced_options.h
Outdated
// FIFO: not supported. Setting this option has no effect for FIFO compaction. | ||
// | ||
// Universal: when there are files older than `periodic_compaction_seconds`, | ||
// rocksdb will try to do a full compaction if possible. Such compaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe "full compaction" -> "as large a compaction as possible including the last level"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, updated.
cb7b648
to
e2ddd6f
Compare
@cbi42 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Thanks for the review! Added change log and imported the PR. |
@cbi42 has updated the pull request. You must reimport the pull request before landing. |
@cbi42 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
f96a1e5
to
5853473
Compare
@cbi42 has updated the pull request. You must reimport the pull request before landing. |
@cbi42 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: this is stacked on #11550 to further clarify usage of these two options for universal compaction. Similar to FIFO, the two options have the same meaning for universal compaction, which can be confusing to use. For example, for universal compaction, dynamically changing the value of
ttl
has no impact on periodic compactions. Users should dynamically changeperiodic_compaction_seconds
instead. From feature matrix (https://fburl.com/daiquery/5s647hwh), there are instances where users setttl
to non-zero value andperiodic_compaction_seconds
to 0. For backward compatibility reason, instead of deprecatingttl
, comments are added to mention thatperiodic_compaction_seconds
are preferred. InSanitizeOptions()
, we update the value ofperiodic_compaction_seconds
to take into account value ofttl
. The logic is documented in relevant option comment.Test plan:
DBTestUniversalCompaction2.PeriodicCompactionDefault