Use default FileSystem in GenerateUniqueId (#7672)
Summary: Use ```FileSystem::Default``` to read ```/proc/sys/kernel/uuid```, so it works for ```Envs``` with remote ```FileSystem``` as well. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7672 Reviewed By: riversand963 Differential Revision: D24998702 Pulled By: anand1976 fbshipit-source-id: fa95c1d70f0e4ed17561201f047aa055046d06c3
This commit is contained in:
parent
d15cc91241
commit
c43be4f30c
5
env/env_posix.cc
vendored
5
env/env_posix.cc
vendored
@ -463,11 +463,12 @@ void PosixEnv::WaitForJoin() {
|
|||||||
|
|
||||||
std::string Env::GenerateUniqueId() {
|
std::string Env::GenerateUniqueId() {
|
||||||
std::string uuid_file = "/proc/sys/kernel/random/uuid";
|
std::string uuid_file = "/proc/sys/kernel/random/uuid";
|
||||||
|
std::shared_ptr<FileSystem> fs = FileSystem::Default();
|
||||||
|
|
||||||
Status s = FileExists(uuid_file);
|
Status s = fs->FileExists(uuid_file, IOOptions(), nullptr);
|
||||||
if (s.ok()) {
|
if (s.ok()) {
|
||||||
std::string uuid;
|
std::string uuid;
|
||||||
s = ReadFileToString(this, uuid_file, &uuid);
|
s = ReadFileToString(fs.get(), uuid_file, &uuid);
|
||||||
if (s.ok()) {
|
if (s.ok()) {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user