imay commented on a change in pull request #2235: Support setting properties 
for storage_root_path
URL: https://github.com/apache/incubator-doris/pull/2235#discussion_r348430812
 
 

 ##########
 File path: be/src/olap/options.cpp
 ##########
 @@ -29,36 +29,96 @@ namespace doris {
 
 // compatible with old multi path configuration:
 // /path1,2014;/path2,2048
-OLAPStatus parse_conf_store_paths(
-        const std::string& config_path,
-        std::vector<StorePath>* paths) {
+OLAPStatus parse_root_path(const std::string& root_path, StorePath* path) {
+    std::vector<std::string> tmp_vec;
+    boost::split(tmp_vec, root_path, boost::is_any_of(","),
+                 boost::token_compress_on);
+
+    // parse root path name
+    boost::trim(tmp_vec[0]);
+    tmp_vec[0].erase(tmp_vec[0].find_last_not_of("/") + 1);
+    if (tmp_vec[0].empty() || tmp_vec[0][0] != '/') {
+        LOG(WARNING) << "invalid store path. path=" << tmp_vec[0];
+        return OLAP_ERR_INPUT_PARAMETER_ERROR;
+    }
+    path->path = tmp_vec[0];
+
+    // parse root path capacity and storage medium
+    std::string capacity_str, medium_str;
+
+    boost::filesystem::path boost_path = tmp_vec[0];
+    std::string extension =
+        boost::filesystem::canonical(boost_path).extension().string();
+    if (!extension.empty()) {
+        medium_str = extension.substr(1);
+    }
+
+    for (int i = 1; i < tmp_vec.size(); i++) {
+        // <property>:<value> or <value>
+        std::string property, value;
+        std::size_t found = tmp_vec[i].find(':');
+        if (found != std::string::npos) {
+            property = boost::trim_copy(tmp_vec[i].substr(0, found));
+            value = boost::trim_copy(tmp_vec[i].substr(found + 1));
+        } else {
+            // <value> only supports setting capacity
+            property = "capacity";
+            value = boost::trim_copy(tmp_vec[i]);
+        }
+        if (property == "capacity") {
 
 Review comment:
   ```suggestion
           if (boost::iequals(property, "capacity")) {
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to