You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2019/12/01 14:17:16 UTC

[GitHub] [incubator-doris] chaoyli commented on a change in pull request #2212: Add rowset convert

chaoyli commented on a change in pull request #2212: Add rowset convert
URL: https://github.com/apache/incubator-doris/pull/2212#discussion_r352347343
 
 

 ##########
 File path: be/src/olap/snapshot_manager.cpp
 ##########
 @@ -546,4 +538,45 @@ OLAPStatus SnapshotManager::_create_snapshot_files(
     return res;
 }
 
+OLAPStatus SnapshotManager::_convert_beta_rowsets_to_alpha(const TabletMetaSharedPtr& new_tablet_meta,
+                const vector<RowsetMetaSharedPtr>& rowset_metas, const std::string& dst_path, bool is_incremental) {
+    OLAPStatus res = OLAP_SUCCESS;
+    RowsetConverter rowset_converter(new_tablet_meta);
+    std::vector<RowsetMetaSharedPtr> new_rowset_metas;
+    bool modified = false;
+    for (auto& rowset_meta : rowset_metas) {
+        if (rowset_meta->rowset_type() == BETA_ROWSET) {
+            modified = true;
+            RowsetMetaPB rowset_meta_pb;
+            auto st = rowset_converter.convert_beta_to_alpha(rowset_meta, dst_path, &rowset_meta_pb);
+            if (st != OLAP_SUCCESS) {
+                res = st;
+                LOG(WARNING) << "convert beta to alpha failed"
+                        << ", tablet_id:" << new_tablet_meta->tablet_id()
+                        << ", schema hash:" << new_tablet_meta->schema_hash()
+                        << ", src rowset:" << rowset_meta->rowset_id()
+                        << ", error:" << st;
+                break;
+            }
+            RowsetMetaSharedPtr new_rowset_meta(new AlphaRowsetMeta());
+            bool ret = new_rowset_meta->init_from_pb(rowset_meta_pb);
+            if (!ret) {
+                res = OLAP_ERR_INIT_FAILED;
+                break;
+            }
+            new_rowset_metas.push_back(new_rowset_meta);
+        } else {
+            new_rowset_metas.push_back(rowset_meta);
+        }
+    }
+    if (res == OLAP_SUCCESS && modified) {
 
 Review comment:
   if modified is false, I think there is no necessity to call revise_rs_metas, because the new_tablet_meta is not changed.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org