Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cbi42 committed Dec 26, 2024
1 parent 1acd315 commit b3c0c09
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 5 additions & 4 deletions db/db_impl/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1300,11 +1300,12 @@ Status DBImpl::SetOptions(
VersionEdit dummy_edit;
s = versions_->LogAndApply(cfd, new_options, read_options, write_options,
&dummy_edit, &mutex_, directories_.GetDbDir());
// Trigger possible flush/compactions. This has to be before we persist
// options to file, otherwise there will be a deadlock with writer
// thread.
if (!versions_->io_status().ok()) {
assert(!s.ok());
error_handler_.SetBGError(versions_->io_status(),
BackgroundErrorReason::kManifestWrite);
}
InstallSuperVersionAndScheduleWork(cfd, &sv_context, new_options);

persist_options_status =
WriteOptionsFile(write_options, true /*db_mutex_already_held*/);
bg_cv_.SignalAll();
Expand Down
2 changes: 2 additions & 0 deletions db/error_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,8 @@ Status ErrorHandler::ClearBGError() {

// Signal that recovery succeeded
if (recovery_error_.ok()) {
// If this assertion fails, it means likely bg error is not set after a
// file is quarantined during MANIFEST write.
assert(files_to_quarantine_.empty());
Status old_bg_error = bg_error_;
// old_bg_error is only for notifying listeners, so may not be checked
Expand Down
2 changes: 2 additions & 0 deletions db/version_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5939,6 +5939,8 @@ Status VersionSet::LogAndApply(
}
TEST_SYNC_POINT_CALLBACK("VersionSet::LogAndApply:WakeUpAndDone", mu);
#endif /* !NDEBUG */
// FIXME: One MANIFEST write failure can cause all writes to SetBGError,
// should only SetBGError once.
return first_writer.status;
}

Expand Down

0 comments on commit b3c0c09

Please sign in to comment.