github-actions[bot] commented on code in PR #43253:
URL: https://github.com/apache/doris/pull/43253#discussion_r1828992559


##########
cloud/src/resource-manager/resource_manager.cpp:
##########
@@ -199,6 +200,28 @@ bool ResourceManager::check_cluster_params_valid(const 
ClusterPB& cluster, std::
     return no_err;
 }
 
+std::pair<bool, std::string> 
ResourceManager::get_instance_id_by_degrade_unique_id(
+        const std::string& cloud_unique_id) {
+    auto v = split(cloud_unique_id, ':');
+    if (v.size() != 3) return {false, ""};

Review Comment:
   warning: statement should be inside braces 
[readability-braces-around-statements]
   
   ```suggestion
       if (v.size() != 3) { return {false, ""};
   }
   ```
   



##########
cloud/src/resource-manager/resource_manager.cpp:
##########
@@ -199,6 +200,28 @@
     return no_err;
 }
 
+std::pair<bool, std::string> 
ResourceManager::get_instance_id_by_degrade_unique_id(
+        const std::string& cloud_unique_id) {
+    auto v = split(cloud_unique_id, ':');
+    if (v.size() != 3) return {false, ""};
+    // degraded format check it
+    int version = std::atoi(v[0].c_str());
+    if (version != 1) return {false, ""};

Review Comment:
   warning: statement should be inside braces 
[readability-braces-around-statements]
   
   ```suggestion
       if (version != 1) { return {false, ""};
   }
   ```
   



##########
cloud/src/resource-manager/resource_manager.cpp:
##########
@@ -199,6 +200,28 @@
     return no_err;
 }
 
+std::pair<bool, std::string> 
ResourceManager::get_instance_id_by_degrade_unique_id(
+        const std::string& cloud_unique_id) {
+    auto v = split(cloud_unique_id, ':');
+    if (v.size() != 3) return {false, ""};
+    // degraded format check it
+    int version = std::atoi(v[0].c_str());
+    if (version != 1) return {false, ""};
+    return {true, v[1]};
+}
+
+bool ResourceManager::check_degrade_instance_valid(const std::string& 
instance_id) {
+    // check kv
+    auto [c0, m0] = get_instance(nullptr, instance_id, nullptr);
+    { TEST_SYNC_POINT_CALLBACK("check_degrade_instance_valid", &c0); }
+    if (c0 != TxnErrorCode::TXN_OK) {
+        LOG(WARNING) << "check instance instance_id=" << instance_id
+                     << " failed, code=" << format_as(c0) << ", info=" + m0;
+        return false;

Review Comment:
   warning: redundant boolean literal in conditional return statement 
[readability-simplify-boolean-expr]
   
   cloud/src/resource-manager/resource_manager.cpp:216:
   ```diff
   -     if (c0 != TxnErrorCode::TXN_OK) {
   -         LOG(WARNING) << "check instance instance_id=" << instance_id
   -                      << " failed, code=" << format_as(c0) << ", info=" + 
m0;
   -         return false;
   -     }
   -     return true;
   +     return !c0 != TxnErrorCode::TXN_OK;
   ```
   



-- 
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: commits-unsubscr...@doris.apache.org

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


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

Reply via email to