morningman commented on a change in pull request #4704: URL: https://github.com/apache/incubator-doris/pull/4704#discussion_r502741974
########## File path: be/src/http/action/update_config_action.cpp ########## @@ -38,25 +38,53 @@ namespace doris { const static std::string HEADER_JSON = "application/json"; +const static std::string PERSIST_PARAM = "persist"; + void UpdateConfigAction::handle(HttpRequest* req) { LOG(INFO) << req->debug_string(); Status s; std::string msg; - if (req->params()->size() != 1) { + // We only support set one config at a time, and along with a optional param "persist". + // So the number of query params should at most be 2. + if (req->params()->size() > 2 || req->params()->size() < 1) { s = Status::InvalidArgument(""); msg = "Now only support to set a single config once, via 'config_name=new_value'"; Review comment: ok ########## File path: be/src/http/action/update_config_action.cpp ########## @@ -38,25 +38,53 @@ namespace doris { const static std::string HEADER_JSON = "application/json"; +const static std::string PERSIST_PARAM = "persist"; + void UpdateConfigAction::handle(HttpRequest* req) { LOG(INFO) << req->debug_string(); Status s; std::string msg; - if (req->params()->size() != 1) { + // We only support set one config at a time, and along with a optional param "persist". + // So the number of query params should at most be 2. + if (req->params()->size() > 2 || req->params()->size() < 1) { s = Status::InvalidArgument(""); msg = "Now only support to set a single config once, via 'config_name=new_value'"; } else { - DCHECK(req->params()->size() == 1); - const std::string& config = req->params()->begin()->first; - const std::string& new_value = req->params()->begin()->second; - s = config::set_config(config, new_value); - if (s.ok()) { - LOG(INFO) << "set_config " << config << "=" << new_value << " success"; - } else { - LOG(WARNING) << "set_config " << config << "=" << new_value << " failed"; - msg = strings::Substitute("set $0=$1 failed, reason: $2", config, new_value, - s.to_string()); + if (req->params()->size() == 1) { + const std::string& config = req->params()->begin()->first; + const std::string& new_value = req->params()->begin()->second; + s = config::set_config(config, new_value, false); + if (s.ok()) { + LOG(INFO) << "set_config " << config << "=" << new_value << " success"; + } else { + LOG(WARNING) << "set_config " << config << "=" << new_value << " failed"; + msg = strings::Substitute("set $0=$1 failed, reason: $2", config, new_value, + s.to_string()); + } + } else if (req->params()->size() == 2) { + if (req->params()->find(PERSIST_PARAM) == req->params()->end()) { + s = Status::InvalidArgument(""); + msg = "Now only support to set a single config once, via 'config_name=new_value'"; Review comment: ok ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org