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

Handle blob files when options.best_efforts_recovery is true #8180

Closed
wants to merge 7 commits into from

Conversation

riversand963
Copy link
Contributor

@riversand963 riversand963 commented Apr 12, 2021

If options.best_efforts_recovery == true, RocksDB currently tolerates missing table files and recovers to the latest version without missing table files (not considering WAL). It is necessary to handle blob files as well to make the feature more complete.

Test plan
make check

@riversand963 riversand963 marked this pull request as ready for review April 13, 2021 19:16
Copy link
Contributor

@ltamasi ltamasi left a comment

Choose a reason for hiding this comment

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

Thanks so much for the patch @riversand963 !

db/version_builder.cc Show resolved Hide resolved
@@ -267,6 +267,51 @@ TEST_F(DBBlobBasicTest, GenerateIOTracing) {
}
#endif // !ROCKSDB_LITE

TEST_F(DBBlobBasicTest, BestEffortsRecovery_MissingNewestBlobFile) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add some comments here to explain what's happening in this test case? IIUC we flush four SST file-blob file pairs, then delete the blob file from the fourth one, resulting in the Version created by the third flush being the latest recoverable one. Right?

P.S. I've just realized we write just enough SSTs to trigger a compaction; I'm wondering if that's necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Originally, I added the compaction because I would like to demonstrate that no new blob files are generated during this test even with compaction, but I think you are right too. It's not necessary.

@@ -437,6 +439,8 @@ ColumnFamilyData* VersionEditHandler::CreateCfAndInit(
if (track_missing_files_) {
cf_to_missing_files_.emplace(edit.column_family_,
std::unordered_set<uint64_t>());
cf_to_missing_blob_files_high_.emplace(edit.column_family_,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we update VersionEditHandler::HasMissingFiles?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch.

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@ltamasi ltamasi left a comment

Choose a reason for hiding this comment

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

LGTM, thanks once again @riversand963!

// MANIFEST. We check whether we have any missing table and blob files.
const bool prev_has_missing_files =
!missing_files.empty() ||
(builder &&
Copy link
Contributor

Choose a reason for hiding this comment

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

How about replacing the non-null check for builder with prev_missing_blob_file_high != kInvalidBlobFileNumber? The latter implies the former and might be easier to understand... I.e.:

const bool prev_has_missing_files = !missing_files.empty() || (prev_missing_blob_file_high != kInvalidBlobFileNumber && prev_missing_blob_file_high >= builder->GetMinOldestBlobFileNumber());

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@riversand963 merged this pull request in b0e2019.

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