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

FindObsoleteFiles should full scan after dropping CF #12087

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hengku
Copy link

@hengku hengku commented Nov 22, 2023

When dropping CFs right after heavy write (flush and/or compaction was still ongoing), I observed that there were many sst files left forever unless restarting rocksdb. I checked manifest and those sst files were not there. It seems this issue was introduced since PR #5275, as shutdown process can cleanup orphan/obsolete sst files, so no need to force a full scan when calling FindObsoleteFiles. However, dropping CF cannot cleanup those files and needs a full scan.

When dropping CFs right after heavy write (flush and/or compaction was still ongoing), I observed that there were many sst files left forever unless restarting rocksdb. I checked manifest and those sst files were not there. It seems this issue was introduced since PR facebook#5275 (facebook#5275), as shutdown process can cleanup orphan/obsolete sst files, so no need to force a full scan when calling FindObsoleteFiles. However, dropping CF cannot cleanup those files and needs a full scan.
@facebook-github-bot
Copy link
Contributor

Hi @hengku!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@jowlyzhang
Copy link
Contributor

Thank you for reporting the issue and the proposed fix. Since SST files won't get deleted immediately after a column family is dropped. They will only be deleted after all outstanding ColumnFamilyHandle are deleted. See "DropColumnFamily " section in https://github.com/facebook/rocksdb/wiki/Column-Families Just want to exclude this possibility. For the issue you observed, do you have ways to make sure all the ColumnFamilyHandle held by the application are destroyed?

@hengku
Copy link
Author

hengku commented Nov 23, 2023

Thank you for the follow up. Yes, I tried both DestroyColumnFamilyHandle and column family reset, but it didn't help. It seems those left-over sst files were not found by FindObsoleteFiles unless a full scan probably because of the following: the input/output sst files related to a compaction/flush will be associated with a version_set in manifest after that compaction/flush is completed successfully. However, if column families are dropped in the middle of that compaction/flush (failure case), those sst files might not be associated with a version_set correctly and become orphan files.

@hengku
Copy link
Author

hengku commented Nov 28, 2023

Hi @jowlyzhang, this is my first PR to rocksdb community, may I know who would help to review it? Thank you!

@jowlyzhang
Copy link
Contributor

Hi @jowlyzhang, this is my first PR to rocksdb community, may I know who would help to review it? Thank you!

I can review this. We usually add a unit test to reproduce the exact issue getting fixed. I'm also checking this scenario to see if we can have a more targeted fix than doing a whole scan.

@jowlyzhang jowlyzhang self-requested a review November 28, 2023 17:03
@hengku
Copy link
Author

hengku commented Nov 28, 2023

got it, thank you @jowlyzhang

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.

None yet

3 participants