rocksdb: set errno to support Myrocks engine

Myrocks engine uses errno(ENOENT) as one of the condition
to create new database, this is okay for POSIX environment,
to support MySQL, spdk environment layer set errno to right
value as well.

Change-Id: Ib633f915ffafde0eacc0a8a0c451e510396d9176
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/369320
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Changpeng Liu 2017-07-14 10:36:09 +08:00 committed by Jim Harris
parent 4ce7dd66cd
commit 4c408e7924

View File

@ -293,7 +293,12 @@ public:
result->reset(new SpdkSequentialFile(file));
return Status::OK();
} else {
return IOError(fname, rc);
/* Myrocks engine uses errno(ENOENT) as one
* special condition, for the purpose to
* support MySQL, set the errno to right value.
*/
errno = -rc;
return IOError(fname, errno);
}
} else {
return PosixEnv::NewSequentialFile(fname, result, options);