diff --git a/include/rocksdb/status.h b/include/rocksdb/status.h index 078d5c1b4..40f3eecd2 100644 --- a/include/rocksdb/status.h +++ b/include/rocksdb/status.h @@ -70,6 +70,7 @@ class Status { kLockLimit = 3, kNoSpace = 4, kDeadlock = 5, + kStaleFile = 6, kMaxSubCode }; diff --git a/util/io_posix.h b/util/io_posix.h index 3bf155a82..5fb8f85c4 100644 --- a/util/io_posix.h +++ b/util/io_posix.h @@ -26,9 +26,14 @@ namespace rocksdb { static Status IOError(const std::string& context, int err_number) { - return (err_number == ENOSPC) ? - Status::NoSpace(context, strerror(err_number)) : - Status::IOError(context, strerror(err_number)); + switch (err_number) { + case ENOSPC: + return Status::NoSpace(context, strerror(err_number)); + case ESTALE: + return Status::IOError(Status::kStaleFile); + default: + return Status::IOError(context, strerror(err_number)); + } } class PosixHelper { diff --git a/util/status_message.cc b/util/status_message.cc index 94ae65128..01956f26c 100644 --- a/util/status_message.cc +++ b/util/status_message.cc @@ -12,7 +12,9 @@ const char* Status::msgs[] = { "Timeout Acquiring Mutex", // kMutexTimeout "Timeout waiting to lock key", // kLockTimeout "Failed to acquire lock due to max_num_locks limit", // kLockLimit - "No space left on device" // kNoSpace + "No space left on device", // kNoSpace + "Deadlock", // kDeadlock + "Stale file handle" // kStaleFile }; } // namespace rocksdb