diff --git a/CHANGELOG.md b/CHANGELOG.md index 69e40ea6fb..f86f15976a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ Please mark all change in change log and use the issue from GitHub - \#1530 Set table file with correct engine type in meta - \#1532 Search with ivf_flat failed with open-dataset: sift-256-hamming - \#1535 Degradation searching performance with metric_type: binary_idmap +- \#1549 Fix server/wal config setting bug - \#1556 Index file not created after table and index created - \#1560 Search crashed with Super-high dimensional binary vector diff --git a/core/src/server/Config.cpp b/core/src/server/Config.cpp index f0b88fa98c..f1a3a421f7 100644 --- a/core/src/server/Config.cpp +++ b/core/src/server/Config.cpp @@ -1529,8 +1529,7 @@ Status Config::GetStorageConfigS3Enable(bool& value) { std::string str = GetConfigStr(CONFIG_STORAGE, CONFIG_STORAGE_S3_ENABLE, CONFIG_STORAGE_S3_ENABLE_DEFAULT); CONFIG_CHECK(CheckStorageConfigS3Enable(str)); - std::transform(str.begin(), str.end(), str.begin(), ::tolower); - value = (str == "true" || str == "on" || str == "yes" || str == "1"); + CONFIG_CHECK(StringHelpFunctions::ConvertToBoolean(str, value)); return Status::OK(); } @@ -1569,8 +1568,7 @@ Status Config::GetMetricConfigEnableMonitor(bool& value) { std::string str = GetConfigStr(CONFIG_METRIC, CONFIG_METRIC_ENABLE_MONITOR, CONFIG_METRIC_ENABLE_MONITOR_DEFAULT); CONFIG_CHECK(CheckMetricConfigEnableMonitor(str)); - std::transform(str.begin(), str.end(), str.begin(), ::tolower); - value = (str == "true" || str == "on" || str == "yes" || str == "1"); + CONFIG_CHECK(StringHelpFunctions::ConvertToBoolean(str, value)); return Status::OK(); } @@ -1671,8 +1669,7 @@ Status Config::GetGpuResourceConfigEnable(bool& value) { std::string str = GetConfigStr(CONFIG_GPU_RESOURCE, CONFIG_GPU_RESOURCE_ENABLE, CONFIG_GPU_RESOURCE_ENABLE_DEFAULT); CONFIG_CHECK(CheckGpuResourceConfigEnable(str)); - std::transform(str.begin(), str.end(), str.begin(), ::tolower); - value = (str == "true" || str == "on" || str == "yes" || str == "1"); + CONFIG_CHECK(StringHelpFunctions::ConvertToBoolean(str, value)); return Status::OK(); } @@ -1774,8 +1771,7 @@ Status Config::GetWalConfigEnable(bool& wal_enable) { std::string str = GetConfigStr(CONFIG_WAL, CONFIG_WAL_ENABLE, CONFIG_WAL_ENABLE_DEFAULT); CONFIG_CHECK(CheckWalConfigEnable(str)); - std::transform(str.begin(), str.end(), str.begin(), ::tolower); - wal_enable = (str == "true" || str == "on" || str == "yes" || str == "1"); + CONFIG_CHECK(StringHelpFunctions::ConvertToBoolean(str, wal_enable)); return Status::OK(); } @@ -1784,8 +1780,7 @@ Config::GetWalConfigRecoveryErrorIgnore(bool& recovery_error_ignore) { std::string str = GetConfigStr(CONFIG_WAL, CONFIG_WAL_RECOVERY_ERROR_IGNORE, CONFIG_WAL_RECOVERY_ERROR_IGNORE_DEFAULT); CONFIG_CHECK(CheckWalConfigRecoveryErrorIgnore(str)); - std::transform(str.begin(), str.end(), str.begin(), ::tolower); - recovery_error_ignore = (str == "true" || str == "on" || str == "yes" || str == "1"); + CONFIG_CHECK(StringHelpFunctions::ConvertToBoolean(str, recovery_error_ignore)); return Status::OK(); } @@ -2013,7 +2008,7 @@ Config::SetWalConfigEnable(const std::string& value) { Status Config::SetWalConfigRecoveryErrorIgnore(const std::string& value) { CONFIG_CHECK(CheckWalConfigRecoveryErrorIgnore(value)); - return SetConfigValueInMem(CONFIG_WAL, CONFIG_WAL_RECOVERY_ERROR_IGNORE_DEFAULT, value); + return SetConfigValueInMem(CONFIG_WAL, CONFIG_WAL_RECOVERY_ERROR_IGNORE, value); } Status diff --git a/core/src/server/web_impl/controller/WebController.hpp b/core/src/server/web_impl/controller/WebController.hpp index ab2a26c2ca..55a51168a3 100644 --- a/core/src/server/web_impl/controller/WebController.hpp +++ b/core/src/server/web_impl/controller/WebController.hpp @@ -336,7 +336,7 @@ class WebController : public oatpp::web::server::api::ApiController { ADD_CORS(CreateIndex) - ENDPOINT("POST", "/tables/{collection_name}/indexes", CreateIndex, + ENDPOINT("POST", "/collections/{collection_name}/indexes", CreateIndex, PATH(String, collection_name), BODY_STRING(String, body)) { TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "POST \'/tables/" + collection_name->std_str() + "/indexes\'"); tr.RecordSection("Received request."); @@ -674,15 +674,15 @@ class WebController : public oatpp::web::server::api::ApiController { ADD_CORS(SystemOp) - ENDPOINT("PUT", "/system/{Op}", SystemOp, PATH(String, Op), BODY_STRING(String, body_str)) { - TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "PUT \'/system/" + Op->std_str() + "\'"); + ENDPOINT("PUT", "/system/{op}", SystemOp, PATH(String, op), BODY_STRING(String, body_str)) { + TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "PUT \'/system/" + op->std_str() + "\'"); tr.RecordSection("Received request."); WebRequestHandler handler = WebRequestHandler(); handler.RegisterRequestHandler(::milvus::server::RequestHandler()); String response_str; - auto status_dto = handler.SystemOp(Op, body_str, response_str); + auto status_dto = handler.SystemOp(op, body_str, response_str); std::shared_ptr response; switch (status_dto->code->getValue()) { diff --git a/core/src/server/web_impl/handler/WebRequestHandler.cpp b/core/src/server/web_impl/handler/WebRequestHandler.cpp index 92d68e77ca..72f04aa748 100644 --- a/core/src/server/web_impl/handler/WebRequestHandler.cpp +++ b/core/src/server/web_impl/handler/WebRequestHandler.cpp @@ -1046,7 +1046,9 @@ WebRequestHandler::CreateIndex(const OString& table_name, const OString& body) { auto status = request_handler_.CreateIndex(context_ptr_, table_name->std_str(), index, request_json["params"]); ASSIGN_RETURN_STATUS_DTO(status); } catch (nlohmann::detail::parse_error& e) { + RETURN_STATUS_DTO(BODY_PARSE_FAIL, e.what()) } catch (nlohmann::detail::type_error& e) { + RETURN_STATUS_DTO(BODY_PARSE_FAIL, e.what()) } ASSIGN_RETURN_STATUS_DTO(Status::OK()) diff --git a/core/unittest/server/test_web.cpp b/core/unittest/server/test_web.cpp index 073e08ec91..00703482e1 100644 --- a/core/unittest/server/test_web.cpp +++ b/core/unittest/server/test_web.cpp @@ -646,7 +646,7 @@ class TestClient : public oatpp::web::client::ApiClient { API_CALL("OPTIONS", "/collections/{collection_name}/indexes", optionsIndexes, PATH(String, collection_name, "collection_name")) - API_CALL("POST", "/tables/{table_name}/indexes", createIndex, PATH(String, table_name, "table_name"), + API_CALL("POST", "/collections/{collection_name}/indexes", createIndex, PATH(String, collection_name, "collection_name"), BODY_STRING(OString, body)) API_CALL("GET", "/collections/{collection_name}/indexes", getIndex, PATH(String, collection_name, "collection_name"))