Summary:
If we want to check whether a Status s is NoSpace() or not, we should check the subcode instread of using s==Status::NoSpace(). Fix some of the incorrect check in the ErrorHandler.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/8504
Test Plan: make check
Reviewed By: anand1976
Differential Revision:
D29601764
Pulled By: zhichao-cao
fbshipit-source-id:
cdab56a827891c23746bba9cbb53f169fe35f086
}
// Allow some error specific overrides
- if (new_bg_err == Status::NoSpace()) {
+ if (new_bg_err.subcode() == IOStatus::SubCode::kNoSpace ||
+ new_bg_err.subcode() == IOStatus::SubCode::kSpaceLimit) {
new_bg_err = OverrideNoSpaceError(new_bg_err, &auto_recovery);
}
recovery_in_prog_ = true;
// Kick-off error specific recovery
- if (bg_error_ == Status::NoSpace()) {
+ if (new_bg_err.subcode() == IOStatus::SubCode::kNoSpace ||
+ new_bg_err.subcode() == IOStatus::SubCode::kSpaceLimit) {
RecoverFromNoSpace();
}
}
// error is also a NoSpace() non-fatal error, leave the instance in
// the list
Status err = cur_instance_->GetBGError();
- if (s.ok() && err == Status::NoSpace() &&
+ if (s.ok() && err.subcode() == IOStatus::SubCode::kNoSpace &&
err.severity() < Status::Severity::kFatalError) {
s = err;
}
#undef GetFreeSpace
virtual Status GetFreeSpace(const std::string& path,
uint64_t* disk_free) override {
- if (!IsFilesystemActive() && error_ == Status::NoSpace()) {
+ if (!IsFilesystemActive() &&
+ error_.subcode() == IOStatus::SubCode::kNoSpace) {
*disk_free = 0;
return Status::OK();
} else {
const IOOptions& options, uint64_t* disk_free,
IODebugContext* dbg) override {
IOStatus io_s;
- if (!IsFilesystemActive() && error_ == IOStatus::NoSpace()) {
+ if (!IsFilesystemActive() &&
+ error_.subcode() == IOStatus::SubCode::kNoSpace) {
*disk_free = 0;
} else {
io_s = target()->GetFreeSpace(path, options, disk_free, dbg);