未验证 提交 b458034a 编写于 作者: B BossZou 提交者: GitHub

Fix Fail to access WAL storage path (#2196) (#2198)

Signed-off-by: NYhz <yinghao.zou@zilliz.com>
上级 14b3e959
......@@ -14,6 +14,7 @@ Please mark all change in change log and use the issue from GitHub
- \#2128 Check has_partition params
- \#2131 Distance/ID returned is not correct if searching with duplicate ids
- \#2141 Fix server start failed if wal directory exist
- \#2196 Fix server start failed if wal is disabled
## Feature
- \#1751 Add api SearchByID
......
......@@ -84,19 +84,27 @@ StorageChecker::CheckStoragePermission() {
}
/* Check wal directory write permission */
std::string wal_path;
status = config.GetWalConfigWalPath(wal_path);
bool wal_enable = false;
status = config.GetWalConfigEnable(wal_enable);
if (!status.ok()) {
return status;
}
ret = access(wal_path.c_str(), F_OK | R_OK | W_OK);
fiu_do_on("StorageChecker.CheckStoragePermission.wal_path_access_fail", ret = -1);
if (0 != ret) {
std::string err_msg = " Access WAL storage path " + wal_path + " fail. " + strerror(errno) +
"(code: " + std::to_string(errno) + ")";
LOG_SERVER_FATAL_ << err_msg;
std::cerr << err_msg << std::endl;
return Status(SERVER_UNEXPECTED_ERROR, err_msg);
if (wal_enable) {
std::string wal_path;
status = config.GetWalConfigWalPath(wal_path);
if (!status.ok()) {
return status;
}
ret = access(wal_path.c_str(), F_OK | R_OK | W_OK);
fiu_do_on("StorageChecker.CheckStoragePermission.wal_path_access_fail", ret = -1);
if (0 != ret) {
std::string err_msg = " Access WAL storage path " + wal_path + " fail. " + strerror(errno) +
"(code: " + std::to_string(errno) + ")";
LOG_SERVER_FATAL_ << err_msg;
std::cerr << err_msg << std::endl;
return Status(SERVER_UNEXPECTED_ERROR, err_msg);
}
}
return Status::OK();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册