diff --git a/env/fs_readonly.h b/env/fs_readonly.h index 77ea1ded8d..89875106ee 100644 --- a/env/fs_readonly.h +++ b/env/fs_readonly.h @@ -23,7 +23,7 @@ class ReadOnlyFileSystem : public FileSystemWrapper { } public: - ReadOnlyFileSystem(const std::shared_ptr& base) + explicit ReadOnlyFileSystem(const std::shared_ptr& base) : FileSystemWrapper(base) {} IOStatus NewWritableFile(const std::string& /*fname*/, @@ -61,10 +61,17 @@ class ReadOnlyFileSystem : public FileSystemWrapper { IODebugContext* /*dbg*/) override { return FailReadOnly(); } - IOStatus CreateDirIfMissing(const std::string& /*dirname*/, - const IOOptions& /*options*/, - IODebugContext* /*dbg*/) override { - return FailReadOnly(); + IOStatus CreateDirIfMissing(const std::string& dirname, + const IOOptions& options, + IODebugContext* dbg) override { + // Allow if dir already exists + bool is_dir = false; + IOStatus s = IsDirectory(dirname, options, &is_dir, dbg); + if (s.ok() && is_dir) { + return s; + } else { + return FailReadOnly(); + } } IOStatus DeleteDir(const std::string& /*dirname*/, const IOOptions& /*options*/, diff --git a/env/fs_remap.h b/env/fs_remap.h index f95ff9de29..4975822f66 100644 --- a/env/fs_remap.h +++ b/env/fs_remap.h @@ -20,7 +20,7 @@ namespace ROCKSDB_NAMESPACE { // guarantees. class RemapFileSystem : public FileSystemWrapper { public: - RemapFileSystem(const std::shared_ptr& base); + explicit RemapFileSystem(const std::shared_ptr& base); protected: // Returns status and mapped-to path in the wrapped filesystem.