From 9627e342c8c9e9fcb39748338a09f3bf02c3256f Mon Sep 17 00:00:00 2001 From: anand76 Date: Mon, 16 Nov 2020 18:41:43 -0800 Subject: [PATCH] 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 --- env/env_posix.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/env/env_posix.cc b/env/env_posix.cc index 78d5e251b..f7efbae80 100644 --- a/env/env_posix.cc +++ b/env/env_posix.cc @@ -463,11 +463,12 @@ void PosixEnv::WaitForJoin() { std::string Env::GenerateUniqueId() { std::string uuid_file = "/proc/sys/kernel/random/uuid"; + std::shared_ptr 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; }