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

Remove the return value of SetBGError() #12792

Closed
wants to merge 3 commits into from

Conversation

cbi42
Copy link
Member

@cbi42 cbi42 commented Jun 21, 2024

Summary: the return value for ErrorHandler::SetBGError(error) seems to be not well-defined, it can be bg_error_ (no matter if the bg_error_ is set to the input error), ok status or recovery_error_ from StartRecoverFromRetryableBGIOError(). The recovery_error_ returned may be an OK status.

We have only a few places that use the return value of SetBGError() and they don't need to do so. Using the return value may even be wrong for example in

s = error_handler_.SetBGError(versions_->io_status(),
where a non-ok s could be overwritten to OK. This PR changes SetBGError() to return void and clean up relevant code.

Test plan: existing unit tests and go over all places where return value of SetBGError() is used.

@cbi42 cbi42 changed the title Remove the return value of SetBGError Remove the return value of SetBGError() Jun 21, 2024
@facebook-github-bot
Copy link
Contributor

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

@cbi42 cbi42 requested a review from ajkr June 22, 2024 03:26
@hx235 hx235 self-requested a review June 22, 2024 23:38
Copy link
Contributor

@hx235 hx235 left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -851,13 +851,17 @@ TEST_F(DBErrorHandlingFSTest, DoubleManifestWriteError) {
});
SyncPoint::GetInstance()->EnableProcessing();
s = Flush();
ASSERT_EQ(s.severity(), ROCKSDB_NAMESPACE::Status::Severity::kHardError);
ASSERT_TRUE(s.IsNoSpace());
ASSERT_EQ(dbfull()->TEST_GetBGError().severity(),
Copy link
Member Author

Choose a reason for hiding this comment

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

For error severity, the only documentation that I found is "If the database instance goes into read-only mode, the following foreground operations will return the error status on all subsequent calls -" from https://github.com/facebook/rocksdb/wiki/Background-Error-Handling#detection which suggests errors returned after DB turns into read-only mode should have the severity set. In that case, I believe we return bg_error_ from error_handler which will have the severity.

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@cbi42 merged this pull request in a31fe52.

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