This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 28f18a33ea4 [improve](config) print value in error message (#29207) 28f18a33ea4 is described below commit 28f18a33ea4a08702d22624141fc5b1791fa3573 Author: Kaijie Chen <c...@apache.org> AuthorDate: Sat Jan 6 18:43:52 2024 +0800 [improve](config) print value in error message (#29207) --- be/src/common/config.cpp | 11 +++++++---- be/src/common/config.h | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp index fe3291e45a1..ae4495142ec 100644 --- a/be/src/common/config.cpp +++ b/be/src/common/config.cpp @@ -1377,8 +1377,8 @@ bool Properties::load(const char* conf_file, bool must_exist) { } template <typename T> -bool Properties::get_or_default(const char* key, const char* defstr, T& retval, - bool* is_retval_set) const { +bool Properties::get_or_default(const char* key, const char* defstr, T& retval, bool* is_retval_set, + std::string& rawval) const { const auto& it = file_conf_map.find(std::string(key)); std::string valstr; if (it == file_conf_map.end()) { @@ -1392,6 +1392,7 @@ bool Properties::get_or_default(const char* key, const char* defstr, T& retval, } else { valstr = it->second; } + rawval = valstr; *is_retval_set = true; return convert(valstr, retval); } @@ -1441,9 +1442,11 @@ std::ostream& operator<<(std::ostream& out, const std::vector<T>& v) { if (strcmp((FIELD).type, #TYPE) == 0) { \ TYPE new_value = TYPE(); \ bool is_newval_set = false; \ + std::string raw_value; \ if (!props.get_or_default((FIELD).name, ((SET_TO_DEFAULT) ? (FIELD).defval : nullptr), \ - new_value, &is_newval_set)) { \ - std::cerr << "config field error: " << (FIELD).name << std::endl; \ + new_value, &is_newval_set, raw_value)) { \ + std::cerr << "config field error: " << (FIELD).name << " = \"" << raw_value << '"' \ + << std::endl; \ return false; \ } \ if (!is_newval_set) { \ diff --git a/be/src/common/config.h b/be/src/common/config.h index 25444346a12..d5aa714a2fe 100644 --- a/be/src/common/config.h +++ b/be/src/common/config.h @@ -1313,7 +1313,8 @@ public: // or set `retval` to `defstr` // if retval is not set(in case defstr is nullptr), set is_retval_set to false template <typename T> - bool get_or_default(const char* key, const char* defstr, T& retval, bool* is_retval_set) const; + bool get_or_default(const char* key, const char* defstr, T& retval, bool* is_retval_set, + std::string& rawval) const; void set(const std::string& key, const std::string& val); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org