[fix](config) for compatibility issue of log dir config (#34734)

* [fix](config) for compatibility issue of log dir config

* 1
This commit is contained in:
Mingyu Chen
2024-05-12 09:44:15 +08:00
committed by yiguolei
parent 20e2d2e2f8
commit cadbbdd2c0
2 changed files with 16 additions and 3 deletions

View File

@ -1679,11 +1679,18 @@ std::vector<std::vector<std::string>> get_config_info() {
std::vector<std::string> _config;
_config.push_back(it.first);
std::string config_val = it.second;
// For compatibility, this PR #32933 change the log dir's config logic,
// and deprecate the `sys_log_dir` config.
if (it.first == "sys_log_dir" && config_val == "") {
config_val = fmt::format("{}/log", std::getenv("DORIS_HOME"));
}
_config.emplace_back(field_it->second.type);
if (0 == strcmp(field_it->second.type, "bool")) {
_config.emplace_back(it.second == "1" ? "true" : "false");
_config.emplace_back(config_val == "1" ? "true" : "false");
} else {
_config.push_back(it.second);
_config.push_back(config_val);
}
_config.emplace_back(field_it->second.valmutable ? "true" : "false");

View File

@ -376,7 +376,13 @@ public class ConfigBase {
if (matcher == null || matcher.match(confKey)) {
List<String> config = Lists.newArrayList();
config.add(confKey);
config.add(getConfValue(f));
String value = getConfValue(f);
// For compatibility, this PR #32933 change the log dir's config logic,
// and deprecate the `sys_log_dir` config.
if (confKey.equals("sys_log_dir") && Strings.isNullOrEmpty(value)) {
value = System.getenv("DORIS_HOME") + "/log";
}
config.add(value);
config.add(f.getType().getSimpleName());
config.add(String.valueOf(confField.mutable()));
config.add(String.valueOf(confField.masterOnly()));