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


##########
be/src/olap/wal/wal_manager.cpp:
##########
@@ -232,9 +233,68 @@ Status WalManager::get_wal_path(int64_t wal_id, 
std::string& wal_path) {
     return Status::OK();
 }
 
-Status WalManager::_scan_wals(const std::string& wal_path) {
-    size_t count = 0;
-    bool exists = true;
+Status WalManager::parse_wal_path(const std::string& file_name, int64_t& 
version,
+                                  int64_t& backend_id, int64_t& wal_id, 
std::string& label) {
+    try {
+        // find version
+        auto pos = file_name.find("_");
+        version = std::strtoll(file_name.substr(0, pos).c_str(), NULL, 10);
+        // find be id
+        auto substring1 = file_name.substr(pos + 1);
+        pos = substring1.find("_");
+        backend_id = std::strtoll(substring1.substr(0, pos).c_str(), NULL, 10);
+        // find wal id
+        auto substring2 = substring1.substr(pos + 1);
+        pos = substring2.find("_");
+        wal_id = std::strtoll(substring2.substr(0, pos).c_str(), NULL, 10);
+        // find label
+        label = substring2.substr(pos + 1);
+        VLOG_DEBUG << "version:" << version << "backend_id:" << backend_id << 
",wal_id:" << wal_id
+                   << ",label:" << label;
+    } catch (const std::invalid_argument& e) {
+        return Status::InvalidArgument("Invalid format, {}", e.what());
+    }
+    return Status::OK();
+}
+
+Status WalManager::_load_wals() {

Review Comment:
   warning: method '_load_wals' can be made static 
[readability-convert-member-functions-to-static]
   
   be/src/olap/wal/wal_manager.h:114:
   ```diff
   -     Status _load_wals();
   +     static Status _load_wals();
   ```
   



-- 
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