This is an automated email from the ASF dual-hosted git repository.

w41ter pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new d875b026b96 [fix](snapshot) Link binlog files according to consistent 
rowsets #41319 (#41345)
d875b026b96 is described below

commit d875b026b965bf5aea5098b8e01dc87db5d246dd
Author: walter <[email protected]>
AuthorDate: Thu Sep 26 21:47:21 2024 +0800

    [fix](snapshot) Link binlog files according to consistent rowsets #41319 
(#41345)
    
    cherry pick from #41319
---
 be/src/olap/snapshot_manager.cpp | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/be/src/olap/snapshot_manager.cpp b/be/src/olap/snapshot_manager.cpp
index d05d51ddffa..56274b9a939 100644
--- a/be/src/olap/snapshot_manager.cpp
+++ b/be/src/olap/snapshot_manager.cpp
@@ -433,13 +433,13 @@ Status SnapshotManager::_create_snapshot_files(const 
TabletSharedPtr& ref_tablet
     string snapshot_id;
     
RETURN_IF_ERROR(io::global_local_filesystem()->canonicalize(snapshot_id_path, 
&snapshot_id));
 
+    std::vector<RowsetSharedPtr> consistent_rowsets;
     do {
         TabletMetaSharedPtr new_tablet_meta(new (nothrow) TabletMeta());
         if (new_tablet_meta == nullptr) {
             res = Status::Error<MEM_ALLOC_FAILED>("fail to malloc 
TabletMeta.");
             break;
         }
-        std::vector<RowsetSharedPtr> consistent_rowsets;
         DeleteBitmap delete_bitmap_snapshot(new_tablet_meta->tablet_id());
 
         /// If set missing_version, try to get all missing version.
@@ -650,17 +650,16 @@ Status SnapshotManager::_create_snapshot_files(const 
TabletSharedPtr& ref_tablet
         }
 
         RowsetBinlogMetasPB rowset_binlog_metas_pb;
-        if (request.__isset.missing_version) {
-            res = ref_tablet->get_rowset_binlog_metas(request.missing_version,
-                                                      &rowset_binlog_metas_pb);
-        } else {
-            std::vector<TVersion> missing_versions;
-            res = ref_tablet->get_rowset_binlog_metas(missing_versions, 
&rowset_binlog_metas_pb);
-        }
-        if (!res.ok()) {
-            break;
+        for (auto& rs : consistent_rowsets) {
+            if (!rs->is_local()) {
+                continue;
+            }
+            res = ref_tablet->get_rowset_binlog_metas(rs->version(), 
&rowset_binlog_metas_pb);
+            if (!res.ok()) {
+                break;
+            }
         }
-        if (rowset_binlog_metas_pb.rowset_binlog_metas_size() == 0) {
+        if (!res.ok() || rowset_binlog_metas_pb.rowset_binlog_metas_size() == 
0) {
             break;
         }
 


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

Reply via email to