Skip to content

Commit

Permalink
[fix](snapshot) Link binlog files according to consistent rowsets #41319
Browse files Browse the repository at this point in the history
 (#41344)

cherry pick from #41319
  • Loading branch information
w41ter authored Sep 30, 2024
1 parent 203d25d commit 4058860
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions be/src/olap/snapshot_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,13 +443,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.
Expand Down Expand Up @@ -660,17 +660,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;
}

Expand Down

0 comments on commit 4058860

Please sign in to comment.