Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hx235 committed Jul 15, 2024
1 parent 755010f commit 36aabb5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
13 changes: 8 additions & 5 deletions db/error_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,6 @@ void ErrorHandler::SetBGError(const Status& bg_status,
// IO error as hard error. Note that, all the NoSpace error should be
// handled by the SstFileManager::StartErrorRecovery(). Therefore, no matter
// it is retryable or file scope, this logic will be bypassed.
bool auto_recovery = false;
EventHelpers::NotifyOnBackgroundError(db_options_.listeners, reason,
&new_bg_io_err, db_mutex_,
&auto_recovery);

RecordStats({ERROR_HANDLER_BG_RETRYABLE_IO_ERROR_COUNT},
{} /* int_histograms */);
Expand All @@ -442,6 +438,10 @@ void ErrorHandler::SetBGError(const Status& bg_status,
ROCKS_LOG_INFO(
db_options_.info_log,
"ErrorHandler: Compaction will schedule by itself to resume\n");
bool auto_recovery = false;
EventHelpers::NotifyOnBackgroundError(db_options_.listeners, reason,
&new_bg_io_err, db_mutex_,
&auto_recovery);
// Not used in this code path.
new_bg_io_err.PermitUncheckedError();
return;
Expand All @@ -466,10 +466,13 @@ void ErrorHandler::SetBGError(const Status& bg_status,
Status bg_err(new_bg_io_err, severity);
CheckAndSetRecoveryAndBGError(bg_err);
recover_context_ = context;
bool auto_recovery = db_options_.max_bgerror_resume_count > 0;
EventHelpers::NotifyOnBackgroundError(db_options_.listeners, reason,
&new_bg_io_err, db_mutex_,
&auto_recovery);
StartRecoverFromRetryableBGIOError(bg_io_err);
return;
}

HandleKnownErrors(new_bg_io_err, reason);
}

Expand Down
3 changes: 2 additions & 1 deletion db_stress_tool/db_stress_listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ class DbStressListener : public EventListener {
}
}

void OnErrorRecoveryCompleted(Status /* old_bg_error */) override {
void OnErrorRecoveryEnd(
const BackgroundErrorRecoveryInfo& /*info*/) override {
RandomSleep();
if (FLAGS_error_recovery_with_no_fault_injection && fault_fs_guard) {
fault_fs_guard->EnableThreadLocalErrorInjection(
Expand Down
1 change: 1 addition & 0 deletions unreleased_history/bug_fixes/event_listener_not_called.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a bug where `OnErrorRecoveryBegin()` is not called before auto recovery starts.

0 comments on commit 36aabb5

Please sign in to comment.