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

Expose the initial logger creation error #10223

Closed

Conversation

riversand963
Copy link
Contributor

#9984 changes the behavior of RocksDB: if logger creation failed during SanitizeOptions(),
DB::Open() will fail. However, since SanitizeOptions() is called in DBImpl::DBImpl(), we cannot
directly expose the error to caller without some additional work.
This is a first version proposal which:

  • Adds a new member init_logger_creation_s to DBImpl to store the result of init logger creation
  • Checks the error during DB::Open() and return it to caller if non-ok

This is not very ideal. We can alternatively move the logger creation logic out of the SanitizeOptions().
Since SanitizeOptions() is used in other places, we need to check whether this change breaks anything
in case other callers of SanitizeOptions() assumes that a logger should be created.

Test plan
make check

@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@pdillinger pdillinger left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@@ -59,6 +60,9 @@ DBOptions SanitizeOptions(const std::string& dbname, const DBOptions& src,
if (!s.ok()) {
// No place suitable for logging
result.info_log = nullptr;
if (logger_creation_s) {
*logger_creation_s = s;
Copy link
Contributor

Choose a reason for hiding this comment

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

We have ASSERT_STATUS_CHECKED failures; if the simplest solution is to PermitUncheckedError() here, that's OK with me (not ideal)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A single PermitUncheckedError() here does not fully fix the issue. We can either:

  • Put a PermitUncheckedError() in ~DBImpl(), or
  • For each of CompactedDB, DBImplSecondary, DBImplReadOnly, explicitly call PermitUncheckedError() shortly after we are done with logger creation.

The latest commit goes by the second approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To keep this fix simple, updated the PR to take the first approach.

@riversand963 riversand963 force-pushed the expose-error-CreateLogger branch from a85f4b7 to 5838d92 Compare June 21, 2022 23:55
@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 Meta 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 Meta employee, you can view this diff on Phabricator.

pdillinger pushed a commit to pdillinger/rocksdb that referenced this pull request Jun 22, 2022
Summary:
facebook#9984 changes the behavior of RocksDB: if logger creation failed during `SanitizeOptions()`,
`DB::Open()` will fail. However, since `SanitizeOptions()` is called in `DBImpl::DBImpl()`, we cannot
directly expose the error to caller without some additional work.
This is a first version proposal which:
- Adds a new member `init_logger_creation_s` to `DBImpl` to store the result of init logger creation
- Checks the error during `DB::Open()` and return it to caller if non-ok

This is not very ideal. We can alternatively move the logger creation logic out of the `SanitizeOptions()`.
Since `SanitizeOptions()` is used in other places, we need to check whether this change breaks anything
in case other callers of `SanitizeOptions()` assumes that a logger should be created.

Pull Request resolved: facebook#10223

Test Plan: make check

Reviewed By: pdillinger

Differential Revision: D37321717

Pulled By: riversand963

fbshipit-source-id: 58042358a86369d606549dd9938933dd47591c4b
@riversand963 riversand963 deleted the expose-error-CreateLogger branch June 22, 2022 15:37
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