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


##########
be/src/olap/olap_meta.cpp:
##########
@@ -93,29 +93,38 @@ Status OlapMeta::init() {
     rocksdb::DB* db;
     std::vector<rocksdb::ColumnFamilyHandle*> handles;
     rocksdb::Status s = DB::Open(options, db_path, column_families, &handles, 
&db);
-    _db = std::unique_ptr<rocksdb::DB, std::function<void(rocksdb::DB*)>>(db, 
[](rocksdb::DB* db) {
-        rocksdb::Status s = db->SyncWAL();
-        if (!s.ok()) {
-            LOG(WARNING) << "rocksdb sync wal failed: " << s.ToString();
-        }
-        rocksdb::CancelAllBackgroundWork(db, true);
-        s = db->Close();
-        if (!s.ok()) {
-            LOG(WARNING) << "rocksdb close failed: " << s.ToString();
-        }
-        LOG(INFO) << "finish close rocksdb for OlapMeta";
+    // rocksdb::DB should not stop its bg work in its de-counstructor.
+    _db = std::unique_ptr<rocksdb::DB>(db);
 
-        delete db;
-    });
     for (auto handle : handles) {
         _handles.emplace_back(handle);
     }
+
     if (!s.ok() || _db == nullptr) {
         return Status::Error<META_OPEN_DB_ERROR>("rocks db open failed, 
reason: {}", s.ToString());
     }
     return Status::OK();
 }
 
+void OlapMeta::stop(bool wait) {

Review Comment:
   warning: method 'stop' can be made static 
[readability-convert-member-functions-to-static]
   
   be/src/olap/olap_meta.h:51:
   ```diff
   -     void stop(bool wait = true);
   +     static void stop(bool wait = true);
   ```
   



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