-
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
Fix a bug in ReFitLevel() where FileMetaData::being_compacted
is not cleared
#13009
Conversation
@@ -1880,7 +1880,7 @@ Status DBImpl::ReFitLevel(ColumnFamilyData* cfd, int level, int target_level) { | |||
Status status = versions_->LogAndApply(cfd, mutable_cf_options, | |||
read_options, write_options, &edit, | |||
&mutex_, directories_.GetDbDir()); | |||
|
|||
c->MarkFilesBeingCompacted(false); |
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.
Seem like an opportunity for future tech debt to bundle related book-keeping together (e.g, release,unregister,MarkFilesBeingCompacted(false), destructor stuff) ...
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 tried to use Compaction::ReleaseCompactionFiles()
here which is more consistent with other places. It failed since in ReFitLevel() we don't call Compaction::FinalizeInputInfo() which sets cfd_ in the compaction, while ReleaseCompactionFiles uses cfd_.
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 as long as it fixes the issue
@cbi42 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: in ReFitLevel(), we were not setting being_compacted to false after ReFitLevel() is done. This is not a issue if refit level is successful, since new FileMetaData is created for files at the target level. However, if there's an error during RefitLevel(), e.g., Manifest write failure, we should clear the being_compacted field for these files. Otherwise, these files will not be picked for compaction until db reopen.
Test plan: existing test.