-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Eliminates a no-op compaction upon snapshot release when disabling auto compactions #7267
Conversation
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
@ajkr PTAL |
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.
Nice find! Can you mention it in "Bug Fixes" section in HISTORY.md?
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.
@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
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.
Hm, actually upon looking further I'm not able to repro the problem using the provided test (without the fix). The test causes one CFD to be enqueued for compaction unnecessarily. But no compaction gets picked due to
rocksdb/db/db_impl/db_impl_compaction_flush.cc
Line 2630 in ce41923
if (!mutable_cf_options->disable_auto_compactions && !cfd->IsDropped()) { |
Yes, this unit test is just to ensure that the compaction shouldn't be scheduled when disabling auto compaction. For the case, it has to get and release snapshot persistently which is typical for scan workload and causes a lot of Do you have any suggestion? |
@Connor1996 has updated the pull request. You must reimport the pull request before landing. |
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
8e6b752
to
f477041
Compare
@Connor1996 has updated the pull request. You must reimport the pull request before landing. |
1 similar comment
@Connor1996 has updated the pull request. You must reimport the pull request before landing. |
ab97fe5
to
6b81128
Compare
@Connor1996 has updated the pull request. You must reimport the pull request before landing. |
I would just suggest making it clear in the title/description/release note that this eliminates a no-op compaction upon snapshot release. "trigger compaction endlessly" sounds like there was an infinite loop somewhere, but my understanding now is that's not the case. Besides that, the fix and test LGTM! |
Also regarding the unit test, you can add a change like this (https://gist.github.com/ajkr/7681bf61b1cdcf76e5510dc9ead2d482) to verify the fix is effective in preventing any no-op compaction. |
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
@Connor1996 has updated the pull request. You must reimport the pull request before landing. |
Thanks for your advice. PTAL again @ajkr |
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. It looks like a lot of HISTORY.md changes related to the markdown.
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.
@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Regarding the markdown changes, if you did intend to include them, would you mind separating them into another PR? Also, we've recently decided to adopt ISO 8601 date format (YYYY-MM-DD). So if you do decide to format all of HISTORY.md, it'd be nice to also change the dates (e.g., "6/12/2020" -> "2020-06-12"). |
@Connor1996 has updated the pull request. You must reimport the pull request before landing. |
6d44814
to
a9a19ff
Compare
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
@Connor1996 has updated the pull request. You must reimport the pull request before landing. |
@ajkr Not intend to do that, it's just changed automatically by markdown-lint. Already revert it. |
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.
@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
…to compactions (facebook#7267) Summary: After releasing a snapshot, it checks whether it is suitable to trigger bottom compactions. When disabling auto compactions, it may still schedule compaction when releasing a snapshot. Whereas no compaction job will be actually handled, so the state of LSM is not changed and compaction will be triggered again and again every time releasing a snapshot. Too frequent compactions lead to high CPU usage and high db_mutex lock contention which affects foreground write duration finally. Pull Request resolved: facebook#7267 Test Plan: - make check - manual test Reviewed By: akankshamahajan15 Differential Revision: D23252880 Pulled By: ajkr fbshipit-source-id: 4431e071a35d9912a2a3592875db27bae521434b
Summary:
After releasing a snapshot, it checks whether it is suitable to trigger bottom compactions.
When disabling auto compactions, it may still schedule compaction when releasing a snapshot. Whereas no compaction job will be actually handled, so the state of LSM is not changed and compaction will be triggered again and again every time releasing a snapshot.
Too frequent compactions lead to high CPU usage and high db_mutex lock contention which affects foreground write duration finally.
Test Plan: