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
main
anand76 4 years ago committed by Facebook GitHub Bot
parent 1c5f13f2a5
commit 9627e342c8
  1. 5
      env/env_posix.cc

5
env/env_posix.cc vendored

@ -463,11 +463,12 @@ void PosixEnv::WaitForJoin() {
std::string Env::GenerateUniqueId() {
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()) {
std::string uuid;
s = ReadFileToString(this, uuid_file, &uuid);
s = ReadFileToString(fs.get(), uuid_file, &uuid);
if (s.ok()) {
return uuid;
}

Loading…
Cancel
Save