Merge pull request #1566 from BossZou/config-bug

Wal Config setting bug (#1549)
pull/1581/head
Jin Hai 2020-03-09 12:45:34 +08:00 committed by GitHub
commit aaf7f4874e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 16 deletions

View File

@ -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 - \#1530 Set table file with correct engine type in meta
- \#1532 Search with ivf_flat failed with open-dataset: sift-256-hamming - \#1532 Search with ivf_flat failed with open-dataset: sift-256-hamming
- \#1535 Degradation searching performance with metric_type: binary_idmap - \#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 - \#1556 Index file not created after table and index created
- \#1560 Search crashed with Super-high dimensional binary vector - \#1560 Search crashed with Super-high dimensional binary vector

View File

@ -1529,8 +1529,7 @@ Status
Config::GetStorageConfigS3Enable(bool& value) { Config::GetStorageConfigS3Enable(bool& value) {
std::string str = GetConfigStr(CONFIG_STORAGE, CONFIG_STORAGE_S3_ENABLE, CONFIG_STORAGE_S3_ENABLE_DEFAULT); std::string str = GetConfigStr(CONFIG_STORAGE, CONFIG_STORAGE_S3_ENABLE, CONFIG_STORAGE_S3_ENABLE_DEFAULT);
CONFIG_CHECK(CheckStorageConfigS3Enable(str)); CONFIG_CHECK(CheckStorageConfigS3Enable(str));
std::transform(str.begin(), str.end(), str.begin(), ::tolower); CONFIG_CHECK(StringHelpFunctions::ConvertToBoolean(str, value));
value = (str == "true" || str == "on" || str == "yes" || str == "1");
return Status::OK(); return Status::OK();
} }
@ -1569,8 +1568,7 @@ Status
Config::GetMetricConfigEnableMonitor(bool& value) { Config::GetMetricConfigEnableMonitor(bool& value) {
std::string str = GetConfigStr(CONFIG_METRIC, CONFIG_METRIC_ENABLE_MONITOR, CONFIG_METRIC_ENABLE_MONITOR_DEFAULT); std::string str = GetConfigStr(CONFIG_METRIC, CONFIG_METRIC_ENABLE_MONITOR, CONFIG_METRIC_ENABLE_MONITOR_DEFAULT);
CONFIG_CHECK(CheckMetricConfigEnableMonitor(str)); CONFIG_CHECK(CheckMetricConfigEnableMonitor(str));
std::transform(str.begin(), str.end(), str.begin(), ::tolower); CONFIG_CHECK(StringHelpFunctions::ConvertToBoolean(str, value));
value = (str == "true" || str == "on" || str == "yes" || str == "1");
return Status::OK(); return Status::OK();
} }
@ -1671,8 +1669,7 @@ Status
Config::GetGpuResourceConfigEnable(bool& value) { Config::GetGpuResourceConfigEnable(bool& value) {
std::string str = GetConfigStr(CONFIG_GPU_RESOURCE, CONFIG_GPU_RESOURCE_ENABLE, CONFIG_GPU_RESOURCE_ENABLE_DEFAULT); std::string str = GetConfigStr(CONFIG_GPU_RESOURCE, CONFIG_GPU_RESOURCE_ENABLE, CONFIG_GPU_RESOURCE_ENABLE_DEFAULT);
CONFIG_CHECK(CheckGpuResourceConfigEnable(str)); CONFIG_CHECK(CheckGpuResourceConfigEnable(str));
std::transform(str.begin(), str.end(), str.begin(), ::tolower); CONFIG_CHECK(StringHelpFunctions::ConvertToBoolean(str, value));
value = (str == "true" || str == "on" || str == "yes" || str == "1");
return Status::OK(); return Status::OK();
} }
@ -1774,8 +1771,7 @@ Status
Config::GetWalConfigEnable(bool& wal_enable) { Config::GetWalConfigEnable(bool& wal_enable) {
std::string str = GetConfigStr(CONFIG_WAL, CONFIG_WAL_ENABLE, CONFIG_WAL_ENABLE_DEFAULT); std::string str = GetConfigStr(CONFIG_WAL, CONFIG_WAL_ENABLE, CONFIG_WAL_ENABLE_DEFAULT);
CONFIG_CHECK(CheckWalConfigEnable(str)); CONFIG_CHECK(CheckWalConfigEnable(str));
std::transform(str.begin(), str.end(), str.begin(), ::tolower); CONFIG_CHECK(StringHelpFunctions::ConvertToBoolean(str, wal_enable));
wal_enable = (str == "true" || str == "on" || str == "yes" || str == "1");
return Status::OK(); return Status::OK();
} }
@ -1784,8 +1780,7 @@ Config::GetWalConfigRecoveryErrorIgnore(bool& recovery_error_ignore) {
std::string str = std::string str =
GetConfigStr(CONFIG_WAL, CONFIG_WAL_RECOVERY_ERROR_IGNORE, CONFIG_WAL_RECOVERY_ERROR_IGNORE_DEFAULT); GetConfigStr(CONFIG_WAL, CONFIG_WAL_RECOVERY_ERROR_IGNORE, CONFIG_WAL_RECOVERY_ERROR_IGNORE_DEFAULT);
CONFIG_CHECK(CheckWalConfigRecoveryErrorIgnore(str)); CONFIG_CHECK(CheckWalConfigRecoveryErrorIgnore(str));
std::transform(str.begin(), str.end(), str.begin(), ::tolower); CONFIG_CHECK(StringHelpFunctions::ConvertToBoolean(str, recovery_error_ignore));
recovery_error_ignore = (str == "true" || str == "on" || str == "yes" || str == "1");
return Status::OK(); return Status::OK();
} }
@ -2013,7 +2008,7 @@ Config::SetWalConfigEnable(const std::string& value) {
Status Status
Config::SetWalConfigRecoveryErrorIgnore(const std::string& value) { Config::SetWalConfigRecoveryErrorIgnore(const std::string& value) {
CONFIG_CHECK(CheckWalConfigRecoveryErrorIgnore(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 Status

View File

@ -336,7 +336,7 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS(CreateIndex) 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)) { PATH(String, collection_name), BODY_STRING(String, body)) {
TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "POST \'/tables/" + collection_name->std_str() + "/indexes\'"); TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "POST \'/tables/" + collection_name->std_str() + "/indexes\'");
tr.RecordSection("Received request."); tr.RecordSection("Received request.");
@ -674,15 +674,15 @@ class WebController : public oatpp::web::server::api::ApiController {
ADD_CORS(SystemOp) ADD_CORS(SystemOp)
ENDPOINT("PUT", "/system/{Op}", SystemOp, PATH(String, Op), BODY_STRING(String, body_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() + "\'"); TimeRecorder tr(std::string(WEB_LOG_PREFIX) + "PUT \'/system/" + op->std_str() + "\'");
tr.RecordSection("Received request."); tr.RecordSection("Received request.");
WebRequestHandler handler = WebRequestHandler(); WebRequestHandler handler = WebRequestHandler();
handler.RegisterRequestHandler(::milvus::server::RequestHandler()); handler.RegisterRequestHandler(::milvus::server::RequestHandler());
String response_str; 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<OutgoingResponse> response; std::shared_ptr<OutgoingResponse> response;
switch (status_dto->code->getValue()) { switch (status_dto->code->getValue()) {

View File

@ -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"]); auto status = request_handler_.CreateIndex(context_ptr_, table_name->std_str(), index, request_json["params"]);
ASSIGN_RETURN_STATUS_DTO(status); ASSIGN_RETURN_STATUS_DTO(status);
} catch (nlohmann::detail::parse_error& e) { } catch (nlohmann::detail::parse_error& e) {
RETURN_STATUS_DTO(BODY_PARSE_FAIL, e.what())
} catch (nlohmann::detail::type_error& e) { } catch (nlohmann::detail::type_error& e) {
RETURN_STATUS_DTO(BODY_PARSE_FAIL, e.what())
} }
ASSIGN_RETURN_STATUS_DTO(Status::OK()) ASSIGN_RETURN_STATUS_DTO(Status::OK())

View File

@ -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("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)) BODY_STRING(OString, body))
API_CALL("GET", "/collections/{collection_name}/indexes", getIndex, PATH(String, collection_name, "collection_name")) API_CALL("GET", "/collections/{collection_name}/indexes", getIndex, PATH(String, collection_name, "collection_name"))