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


##########
be/src/olap/wal_manager.cpp:
##########
@@ -392,4 +392,63 @@
     return Status::OK();
 }
 
+Status WalManager::add_wal_cv_map(int64_t wal_id, std::shared_ptr<std::mutex> 
lock,
+                                  std::shared_ptr<std::condition_variable> cv) 
{
+    std::lock_guard<std::shared_mutex> wrlock(_wal_cv_lock);
+    auto it = _wal_lock_map.find(wal_id);
+    if (it != _wal_lock_map.end()) {
+        return Status::InternalError("wal {} is already in _wal_cv_map ", 
wal_id);
+    }
+    _wal_lock_map.emplace(wal_id, lock);
+    _wal_cv_map.emplace(wal_id, cv);
+    LOG(INFO) << "add  " << wal_id << " to _wal_cv_map";
+    return Status::OK();
+}
+Status WalManager::erase_wal_cv_map(int64_t wal_id) {
+    std::lock_guard<std::shared_mutex> wrlock(_wal_cv_lock);
+    if (_wal_lock_map.erase(wal_id) && _wal_cv_map.erase(wal_id)) {
+        LOG(INFO) << "erase " << wal_id << " from _wal_cv_map";
+    } else {
+        return Status::InternalError("fail to erase wal {} from wal_cv_map", 
wal_id);
+    }
+    return Status::OK();
+}
+Status WalManager::wait_relay_wal_finish(int64_t wal_id) {
+    std::shared_ptr<std::mutex> lock = nullptr;
+    std::shared_ptr<std::condition_variable> cv = nullptr;
+    RETURN_IF_ERROR(get_lock_and_cv(wal_id, lock, cv));
+    std::unique_lock l(*(lock));
+    cv->wait(l);
+    LOG(INFO) << "get wal " << wal_id << ",finish wait";
+    RETURN_IF_ERROR(erase_wal_cv_map(wal_id));
+    LOG(INFO) << "erase wal " << wal_id;
+    return Status::OK();
+}
+
+Status WalManager::notify(int64_t wal_id) {

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



##########
be/src/olap/wal_manager.cpp:
##########
@@ -392,4 +392,63 @@ Status WalManager::get_wal_column_index(int64_t wal_id, 
std::vector<size_t>& col
     return Status::OK();
 }
 
+Status WalManager::add_wal_cv_map(int64_t wal_id, std::shared_ptr<std::mutex> 
lock,
+                                  std::shared_ptr<std::condition_variable> cv) 
{
+    std::lock_guard<std::shared_mutex> wrlock(_wal_cv_lock);
+    auto it = _wal_lock_map.find(wal_id);
+    if (it != _wal_lock_map.end()) {
+        return Status::InternalError("wal {} is already in _wal_cv_map ", 
wal_id);
+    }
+    _wal_lock_map.emplace(wal_id, lock);
+    _wal_cv_map.emplace(wal_id, cv);
+    LOG(INFO) << "add  " << wal_id << " to _wal_cv_map";
+    return Status::OK();
+}
+Status WalManager::erase_wal_cv_map(int64_t wal_id) {

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



##########
be/src/olap/wal_manager.h:
##########
@@ -15,6 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
+#pragma once
 #include <gen_cpp/PaloInternalService_types.h>

Review Comment:
   warning: 'gen_cpp/PaloInternalService_types.h' file not found 
[clang-diagnostic-error]
   ```cpp
   #include <gen_cpp/PaloInternalService_types.h>
            ^
   ```
   



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

Reply via email to