imay commented on a change in pull request #3260: [Storage] open data dirs 
parallelly
URL: https://github.com/apache/incubator-doris/pull/3260#discussion_r402962691
 
 

 ##########
 File path: be/src/olap/storage_engine.cpp
 ##########
 @@ -148,16 +148,33 @@ void StorageEngine::load_data_dirs(const 
std::vector<DataDir*>& data_dirs) {
 
 OLAPStatus StorageEngine::_open() {
     // init store_map
+    std::vector<std::pair<DataDir*,std::future<Status>>> tmp_vec;
     for (auto& path : _options.store_paths) {
+        LOG(INFO) << "store_path " << path.path;
         DataDir* store = new DataDir(path.path, path.capacity_bytes, 
path.storage_medium,
                                      _tablet_manager.get(), 
_txn_manager.get());
-        auto st = store->init();
-        if (!st.ok()) {
-            LOG(WARNING) << "Store load failed, path=" << path.path;
-            return OLAP_ERR_INVALID_ROOT_PATH;
+        tmp_vec.emplace_back(std::make_pair(store,std::async([store](){ return 
store->init();})));
+    }
+
+    try {
+        for (auto& pair : tmp_vec) {
+            DataDir* store = pair.first;
+            auto st = pair.second.get();
+            if (!st.ok()) {
+                throw std::runtime_error("Store load failed, path=" + 
store->path());
 
 Review comment:
   1. Try to avoid using exceptions
   2. Should join all other threads before delete store, otherwise exceptions 
are prone to occur

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to