Skip to content

Commit

Permalink
Status check enforcement for error_handler_fs_test (facebook#7342)
Browse files Browse the repository at this point in the history
Summary:
Added status check enforcement for error_test_fs_test

Pull Request resolved: facebook#7342

Test Plan: ASSERT_STATUS_CHECKED=1 make -j48 error_test_fs_test

Reviewed By: akankshamahajan15

Differential Revision: D23972231

Pulled By: zhichao-cao

fbshipit-source-id: fa41bfe440012e0c55f2c9507c1d0104e5e93f84
  • Loading branch information
zhichao-cao authored and codingrhythm committed Mar 5, 2021
1 parent 22854bd commit eee4103
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 112 deletions.
2 changes: 2 additions & 0 deletions Makefile
Expand Up @@ -600,8 +600,10 @@ ifdef ASSERT_STATUS_CHECKED
env_test \
env_logger_test \
event_logger_test \
error_handler_fs_test \
auto_roll_logger_test \
file_indexer_test \
flush_job_test \
hash_table_test \
hash_test \
heap_test \
Expand Down
4 changes: 3 additions & 1 deletion db/compaction/compaction_job.cc
Expand Up @@ -1465,7 +1465,9 @@ Status CompactionJob::FinishCompactionOutputFile(
"CompactionJob::FinishCompactionOutputFile:"
"MaxAllowedSpaceReached");
InstrumentedMutexLock l(db_mutex_);
db_error_handler_->SetBGError(s, BackgroundErrorReason::kCompaction);
// Should handle return error?
db_error_handler_->SetBGError(s, BackgroundErrorReason::kCompaction)
.PermitUncheckedError();
}
}
#endif
Expand Down
6 changes: 4 additions & 2 deletions db/db_impl/db_impl.cc
Expand Up @@ -407,7 +407,7 @@ Status DBImpl::ResumeImpl(DBRecoverContext context) {
// during previous error handling.
if (file_deletion_disabled) {
// Always return ok
EnableFileDeletions(/*force=*/true);
s = EnableFileDeletions(/*force=*/true);
}
ROCKS_LOG_INFO(immutable_db_options_.info_log, "Successfully resumed DB");
}
Expand Down Expand Up @@ -4553,7 +4553,9 @@ Status DBImpl::IngestExternalFiles(
// be pessimistic and try write to a new MANIFEST.
// TODO: distinguish between MANIFEST write and CURRENT renaming
const IOStatus& io_s = versions_->io_status();
error_handler_.SetBGError(io_s, BackgroundErrorReason::kManifestWrite);
// Should handle return error?
error_handler_.SetBGError(io_s, BackgroundErrorReason::kManifestWrite)
.PermitUncheckedError();
}

// Resume writes to the DB
Expand Down
19 changes: 13 additions & 6 deletions db/db_impl/db_impl_write.cc
Expand Up @@ -840,7 +840,9 @@ void DBImpl::WriteStatusCheckOnLocked(const Status& status) {
mutex_.AssertHeld();
if (immutable_db_options_.paranoid_checks && !status.ok() &&
!status.IsBusy() && !status.IsIncomplete()) {
error_handler_.SetBGError(status, BackgroundErrorReason::kWriteCallback);
// Maybe change the return status to void?
error_handler_.SetBGError(status, BackgroundErrorReason::kWriteCallback)
.PermitUncheckedError();
}
}

Expand All @@ -851,7 +853,9 @@ void DBImpl::WriteStatusCheck(const Status& status) {
if (immutable_db_options_.paranoid_checks && !status.ok() &&
!status.IsBusy() && !status.IsIncomplete()) {
mutex_.Lock();
error_handler_.SetBGError(status, BackgroundErrorReason::kWriteCallback);
// Maybe change the return status to void?
error_handler_.SetBGError(status, BackgroundErrorReason::kWriteCallback)
.PermitUncheckedError();
mutex_.Unlock();
}
}
Expand All @@ -863,7 +867,7 @@ void DBImpl::IOStatusCheck(const IOStatus& io_status) {
!io_status.IsBusy() && !io_status.IsIncomplete()) ||
io_status.IsIOFenced()) {
mutex_.Lock();
// May be change the return status to void?
// Maybe change the return status to void?
error_handler_.SetBGError(io_status, BackgroundErrorReason::kWriteCallback)
.PermitUncheckedError();
mutex_.Unlock();
Expand All @@ -879,7 +883,7 @@ void DBImpl::MemTableInsertStatusCheck(const Status& status) {
if (!status.ok()) {
mutex_.Lock();
assert(!error_handler_.IsBGWorkStopped());
// May be change the return status to void?
// Maybe change the return status to void?
error_handler_.SetBGError(status, BackgroundErrorReason::kMemTable)
.PermitUncheckedError();
mutex_.Unlock();
Expand Down Expand Up @@ -1775,10 +1779,13 @@ Status DBImpl::SwitchMemtable(ColumnFamilyData* cfd, WriteContext* context) {
}
// We may have lost data from the WritableFileBuffer in-memory buffer for
// the current log, so treat it as a fatal error and set bg_error
// Should handle return error?
if (!io_s.ok()) {
error_handler_.SetBGError(io_s, BackgroundErrorReason::kMemTable);
error_handler_.SetBGError(io_s, BackgroundErrorReason::kMemTable)
.PermitUncheckedError();
} else {
error_handler_.SetBGError(s, BackgroundErrorReason::kMemTable);
error_handler_.SetBGError(s, BackgroundErrorReason::kMemTable)
.PermitUncheckedError();
}
// Read back bg_error in order to get the right severity
s = error_handler_.GetBGError();
Expand Down

0 comments on commit eee4103

Please sign in to comment.