Skip to content
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

Prepare for deprecation of Options::access_hint_on_compaction_start #11658

Closed

Conversation

hx235
Copy link
Contributor

@hx235 hx235 commented Jul 31, 2023

Context/Summary:
After #11631, file hint is not longer needed for compaction read. Therefore we can deprecate Options::access_hint_on_compaction_start. As this is a public API change, we should first mark the relevant APIs (including the Java's) deprecated, remove RocksDB internal call paths where this option is used and then officially remove it in next major release 9.0.

Test:
Existing UT

Copy link
Contributor

@ajkr ajkr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After #11631, file hint is not longer needed for compaction read.

For some reason I missed the part of #11631 that stops using file hint in compaction read. Is it there? I thought closing #9448 should mean we stopped using file hints in compaction reads.

Comment on lines 934 to 950
// DEPRECATED
// Specify the file access pattern once a compaction is started.
// It will be applied to all input files of a compaction.
// Default: NORMAL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like #5431, you can add a comment like:

  // This flag has no effect on the behavior of compaction and we plan to delete
  // it in the future.

Then modify BlockBasedTable::SetupForCompaction() to do nothing.

@hx235
Copy link
Contributor Author

hx235 commented Aug 2, 2023

For some reason I missed the part of #11631 that stops using file hint in compaction read. Is it there? I thought closing #9448 should mean we stopped using file hints in compaction reads.

@ajkr Sorry for the confusion - I should have modified SetupForCompaction() in that PR so that it's clear that (1) file hint does not take effect in compaction read (because of explicit readahead) (2)we don't hint anything in compaction read (modify SetupForCompaction()). My "file hint is not longer needed for compaction read" merely means (1) and I have prematurally closed the issue.

Will include "SetupForCompaction()" in this PR and close the issue later. Thanks!

@facebook-github-bot
Copy link
Contributor

@hx235 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@ajkr
Copy link
Contributor

ajkr commented Aug 2, 2023

We should probably execute this sanitization for use_direct_reads==false cases now too:

result.compaction_readahead_size = 1024 * 1024 * 2;

@hx235
Copy link
Contributor Author

hx235 commented Aug 3, 2023

We should probably execute this sanitization for use_direct_reads==false cases now too:

result.compaction_readahead_size = 1024 * 1024 * 2;

Good point!

@facebook-github-bot
Copy link
Contributor

@hx235 has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@hx235 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@hx235 hx235 force-pushed the mark_dep_access_hint_on_compaction_start branch from 451c01c to 0815b03 Compare August 3, 2023 18:16
@facebook-github-bot
Copy link
Contributor

@hx235 has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@hx235 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@hx235 merged this pull request in 09882a5.

hx235 added a commit to hx235/rocksdb that referenced this pull request Aug 28, 2023
hx235 added a commit to hx235/rocksdb that referenced this pull request Aug 28, 2023
facebook-github-bot pushed a commit that referenced this pull request Aug 30, 2023
Summary:
**Context/Summary:**
After #11631, we rely on `compaction_readahead_size` for how much to read ahead for compaction read under non-direct IO case. #11658 therefore also sanitized 0 `compaction_readahead_size` to 2MB under non-direct IO, which is consistent with the existing sanitization with direct IO.

However, this makes disabling compaction readahead impossible as well as add one more scenario to the inconsistent effects between `Options.compaction_readahead_size=0` during DB open and `SetDBOptions("compaction_readahead_size", "0")` .
- `SetDBOptions("compaction_readahead_size", "0")` will disable compaction readahead as its logic never goes through sanitization above while `Options.compaction_readahead_size=0` will go through sanitization.

Therefore we decided to do this PR.

Pull Request resolved: #11762

Test Plan: Modified existing UTs to cover this PR

Reviewed By: ajkr

Differential Revision: D48759560

Pulled By: hx235

fbshipit-source-id: b3f85e58bda362a6fa1dc26bd8a87aa0e171af79
hx235 added a commit that referenced this pull request Aug 30, 2023
Summary:
**Context/Summary:**
After #11631, we rely on `compaction_readahead_size` for how much to read ahead for compaction read under non-direct IO case. #11658 therefore also sanitized 0 `compaction_readahead_size` to 2MB under non-direct IO, which is consistent with the existing sanitization with direct IO.

However, this makes disabling compaction readahead impossible as well as add one more scenario to the inconsistent effects between `Options.compaction_readahead_size=0` during DB open and `SetDBOptions("compaction_readahead_size", "0")` .
- `SetDBOptions("compaction_readahead_size", "0")` will disable compaction readahead as its logic never goes through sanitization above while `Options.compaction_readahead_size=0` will go through sanitization.

Therefore we decided to do this PR.

Pull Request resolved: #11762

Test Plan: Modified existing UTs to cover this PR

Reviewed By: ajkr

Differential Revision: D48759560

Pulled By: hx235

fbshipit-source-id: b3f85e58bda362a6fa1dc26bd8a87aa0e171af79
Yuval-Ariel added a commit to speedb-io/speedb that referenced this pull request Dec 25, 2023
In facebook/rocksdb#11658, files are no longer controlled by the access_hint_on_compaction_start flag by removing the content of SetupForCompaction.
However, this leads to degradation in compaction read speed when combined with compaction_readahead_size since once a file is opened, in linux, it is hinted with POSIX_FADV_RANDOM.

See #787 for full details.

Add back the default hint to avoid degradation in this scenario.
Yuval-Ariel added a commit to speedb-io/speedb that referenced this pull request Dec 31, 2023
In facebook/rocksdb#11658, files are no longer controlled by the access_hint_on_compaction_start flag by removing the content of SetupForCompaction.
However, this leads to degradation in compaction read speed when combined with compaction_readahead_size since once a file is opened, in linux, it is hinted with POSIX_FADV_RANDOM.

See #787 for full details.

Add back the default hint to avoid degradation in this scenario.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants