Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New subcode for IOError to detect the ESTALE errno #1748

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/rocksdb/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class Status {
kLockLimit = 3,
kNoSpace = 4,
kDeadlock = 5,
kStaleFile = 6,
kMaxSubCode
};

Expand Down
11 changes: 8 additions & 3 deletions util/io_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion util/status_message.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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