| 1330 | } |
| 1331 | |
| 1332 | Status MkdirRecursively(rocksdb::Env *env, const std::string &dir) { |
| 1333 | if (env->CreateDirIfMissing(dir).ok()) return Status::OK(); |
| 1334 | |
| 1335 | std::string parent; |
| 1336 | for (auto pos = dir.find('/', 1); pos != std::string::npos; pos = dir.find('/', pos + 1)) { |
| 1337 | parent = dir.substr(0, pos); |
| 1338 | if (auto s = env->CreateDirIfMissing(parent); !s.ok()) { |
| 1339 | ERROR("[storage] Failed to create directory '{}' recursively. Error: {}", parent, s.ToString()); |
| 1340 | return {Status::NotOK}; |
| 1341 | } |
| 1342 | } |
| 1343 | |
| 1344 | if (env->CreateDirIfMissing(dir).ok()) return Status::OK(); |
| 1345 | |
| 1346 | return {Status::NotOK}; |
| 1347 | } |
| 1348 | |
| 1349 | std::unique_ptr<rocksdb::WritableFile> Storage::ReplDataManager::NewTmpFile(Storage *storage, const std::string &dir, |
| 1350 | const std::string &repl_file) { |