github-actions[bot] commented on code in PR #61502:
URL: https://github.com/apache/doris/pull/61502#discussion_r3090535131
##########
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 <<
"\","
Review Comment:
The old `show_config` implementation used RapidJSON, so config values were
escaped before `http_json_reply()` reparsed the payload. This new version
concatenates `value` directly into a JSON string. As soon as a mutable string
config contains `"`, `\`, or another JSON-special character,
`config::show_config()` returns malformed JSON and `/show_config` degrades to
`INTERNAL_ERROR` while still replying `200`. Please keep structured JSON
serialization here instead of manual string concatenation, and add a test that
exercises a string-valued config with JSON-special characters.
--
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]