kangpinghuang commented on a change in pull request #567: Add publish version 
task
URL: https://github.com/apache/incubator-doris/pull/567#discussion_r249739808
 
 

 ##########
 File path: be/src/olap/storage_engine.cpp
 ##########
 @@ -115,96 +115,140 @@ StorageEngine::~StorageEngine() {
     clear();
 }
 
+// TODO(ygl): deal with rowsets and tablets when load failed
 OLAPStatus StorageEngine::_load_data_dir(DataDir* data_dir) {
     std::string data_dir_path = data_dir->path();
     LOG(INFO) <<"start to load tablets from data_dir_path:" << data_dir_path;
-
     bool is_header_converted = false;
-    OLAPStatus res = TabletMetaManager::get_header_converted(data_dir, 
is_header_converted);
+    OLAPStatus res = TabletMetaManager::get_header_converted(data_dir, 
&is_header_converted);
     if (res != OLAP_SUCCESS) {
         LOG(WARNING) << "get convert flag from meta failed";
         return res;
     }
+    if (!is_header_converted) {
+        // ygl: could not be compatable with old doris data. User has to use 
previous version to parse
+        // header file into meta env first.
+        LOG(WARNING) << "header is not converted to tablet meta yet, could not 
use this Doris version. " 
+                    << "[dir path =" << data_dir_path << "]";
+        return OLAP_ERR_INIT_FAILED;
+    }
 
-    // load rowset meta from metaenv and create rowset
+    // load rowset meta from meta env and create rowset
     // COMMITTED: add to txn manager
     // VISIBLE: add to tablet
     // if one rowset load failed, then the total data dir will not be loaded
-    std::vector<std::shared_ptr<RowsetMeta>> dir_rowset_metas;
-    if (is_header_converted) {
-        LOG(INFO) << "begin loading rowset from meta";
-        bool has_error = false;
-        auto load_rowset_func = [this, data_dir, &has_error, 
&dir_rowset_metas](RowsetId rowset_id, const std::string& meta_str) -> bool {
-            std::shared_ptr<RowsetMeta> rowset_meta(new RowsetMeta());
-            bool parsed = rowset_meta->init(meta_str);
-            if (!parsed) {
-                LOG(WARNING) << "parse rowset meta string failed for 
rowset_id:" << rowset_id;
-                has_error = true;
-                // return false will break meta iterator
-                return false;
-            }
-            dir_rowset_metas.push_back(rowset_meta);
+    std::vector<RowsetMetaSharedPtr> dir_rowset_metas;
+    LOG(INFO) << "begin loading rowset from meta";
+    auto load_rowset_func = [this, data_dir, &dir_rowset_metas](RowsetId 
rowset_id, const std::string& meta_str) -> bool {
 
 Review comment:
   use &data_dir

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to