w41ter commented on code in PR #61502:
URL: https://github.com/apache/doris/pull/61502#discussion_r3061910323
##########
cloud/src/common/configbase.cpp:
##########
@@ -462,4 +462,53 @@ std::pair<bool, std::string>
set_config(std::unordered_map<std::string, std::str
std::shared_mutex* get_mutable_string_config_lock() {
return &mutable_string_config_lock;
}
+
+std::string show_config(const std::string& conf_name) {
+ if (full_conf_map == nullptr) {
+ return "";
+ }
+
+ std::ostringstream oss;
+ oss << "[";
+ bool first = true;
+ for (auto& [name, field] : *Register::_s_field_map) {
+ if (!conf_name.empty() && name != conf_name) {
+ continue;
+ }
+ auto it = full_conf_map->find(name);
+ std::string value = (it != full_conf_map->end()) ? it->second : "";
+
+ if (!first) oss << ",";
+ first = false;
+ oss << "[\"" << name << "\",\"" << field.type << "\",\"" << value <<
"\","
+ << (field.valmutable ? "true" : "false") << "]";
Review Comment:
Why not use rapidjson, just like the original implementation? Manually
concatenating strings requires dealing with escape chars.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]