[bugfix] file configuration initialize fail

This commit is contained in:
lizhenyu 2022-03-28 14:49:57 +08:00
parent 44f2e803a2
commit d967d3c666
1 changed files with 2 additions and 13 deletions

View File

@ -1145,19 +1145,8 @@ void ParameterServer::RecoverHandler::Init() {
MS_EXCEPTION_IF_NULL(ps_->server_node_); MS_EXCEPTION_IF_NULL(ps_->server_node_);
std::string persistent_storage_file_path = std::string persistent_storage_file_path =
std::string(kCurrentDirOfServer) + std::to_string(ps_->server_node_->rank_id()) + "_persistent_storage.json"; std::string(kCurrentDirOfServer) + std::to_string(ps_->server_node_->rank_id()) + "_persistent_storage.json";
if (!distributed::storage::FileIOUtils::IsFileOrDirExist(persistent_storage_file_path)) { storage_ = std::make_unique<core::FileConfiguration>(persistent_storage_file_path);
distributed::storage::FileIOUtils::CreateFile(persistent_storage_file_path); (void)storage_->Initialize();
}
auto ret = FileUtils::GetRealPath(persistent_storage_file_path.c_str());
if (!ret.has_value()) {
MS_LOG(EXCEPTION) << "Cannot get real path for persistent storage file";
}
storage_ = std::make_unique<core::FileConfiguration>(ret.value());
if (!storage_->Initialize()) {
MS_LOG(EXCEPTION) << "Initialize file storage module failed, file path: " << ret.value();
}
} }
void ParameterServer::RecoverHandler::Recover() { void ParameterServer::RecoverHandler::Recover() {