You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/06/20 09:37:00 UTC

[GitHub] [incubator-kvrocks] git-hulk commented on a diff in pull request #642: [fix]:load namespace from config file with case-sensitive issue:#640

git-hulk commented on code in PR #642:
URL: https://github.com/apache/incubator-kvrocks/pull/642#discussion_r901460161


##########
src/config.cc:
##########
@@ -523,17 +523,21 @@ Status Config::parseConfigFromString(std::string input, int line_number) {
   if (kv.size() != 2) return Status(Status::NotOK, "wrong number of arguments");
   if (kv[1] == "\"\"") return Status::OK();
 
-  kv[0] = Util::ToLower(kv[0]);
-  auto iter = fields_.find(kv[0]);
+  std::string configKey = Util::ToLower(kv[0]);
+  const char ns_str[] = "namespace.";
+  size_t ns_str_size = sizeof(ns_str) - 1;
+  if (!strncasecmp(kv[0].data(), ns_str, ns_str_size)) {
+      // namespace should keep key case-sensitive
+      configKey = kv[0];
+      tokens[kv[1]] = kv[0].substr(ns_str_size);
+  }
+  auto iter = fields_.find(configKey);

Review Comment:
   ```suggestion
     std::string field_key = Util::ToLower(kv[0]);
     const char ns_str[] = "namespace.";
     size_t ns_str_size = sizeof(ns_str) - 1;
     if (!strncasecmp(kv[0].data(), ns_str, ns_str_size)) {
         // namespace should keep key case-sensitive
         field_key = kv[0];
         tokens[kv[1]] = kv[0].substr(ns_str_size);
     }
     auto iter = fields_.find(field_key);
   ```



-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org