未验证 提交 b65f5072 编写于 作者: W Wang XiangYu 提交者: GitHub

fix server start failed if wal directory exist (#2144)

* fix server start failed if wal directory exist
Signed-off-by: Nwxyu <xy.wang@zilliz.com>

* add wal_enable check
Signed-off-by: Nwxyu <xy.wang@zilliz.com>

* fix compile error
Signed-off-by: Nwxyu <xy.wang@zilliz.com>
上级 bf42dbd5
......@@ -10,6 +10,7 @@ Please mark all change in change log and use the issue from GitHub
- \#1997 Index file missed after compact
- \#2073 Fix CheckDBConfigBackendUrl error message
- \#2076 CheckMetricConfigAddress error message
- \#2141 Fix server start failed if wal directory exist
## Feature
- \#1751 Add api SearchByID
......
......@@ -205,25 +205,43 @@ Server::Start() {
return s;
}
try {
// True if a new directory was created, otherwise false.
boost::filesystem::create_directories(db_path);
} catch (...) {
return Status(SERVER_UNEXPECTED_ERROR, "Cannot create db directory");
}
s = InstanceLockCheck::Check(db_path);
if (!s.ok()) {
std::cerr << "deploy_mode: " << deploy_mode << " instance lock db path failed." << std::endl;
return s;
}
std::string wal_path;
s = config.GetWalConfigWalPath(wal_path);
bool wal_enable = false;
s = config.GetWalConfigEnable(wal_enable);
if (!s.ok()) {
return s;
}
if (not boost::filesystem::create_directories(wal_path)) {
return Status(SERVER_UNEXPECTED_ERROR, "Cannot create wal dir");
}
s = InstanceLockCheck::Check(wal_path);
if (!s.ok()) {
std::cerr << "deploy_mode: " << deploy_mode << " instance lock wal path failed." << std::endl;
return s;
if (wal_enable) {
std::string wal_path;
s = config.GetWalConfigWalPath(wal_path);
if (!s.ok()) {
return s;
}
try {
// True if a new directory was created, otherwise false.
boost::filesystem::create_directories(wal_path);
} catch (...) {
return Status(SERVER_UNEXPECTED_ERROR, "Cannot create wal directory");
}
s = InstanceLockCheck::Check(wal_path);
if (!s.ok()) {
std::cerr << "deploy_mode: " << deploy_mode << " instance lock wal path failed." << std::endl;
return s;
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册