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

 ##########
 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:
   yes, you are right. Here means what you want. If modified is true, it will 
call revise.

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