diff --git a/CHANGELOG.md b/CHANGELOG.md index de2fb6bd2d..5397bff074 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/core/src/server/init/StorageChecker.cpp b/core/src/server/init/StorageChecker.cpp index d64b2e26ce..30be2ca3e6 100644 --- a/core/src/server/init/StorageChecker.cpp +++ b/core/src/server/init/StorageChecker.cpp @@ -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();