You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by w4...@apache.org on 2024/09/26 01:56:47 UTC
(doris) 01/01: [fix](snapshot) Link binlog files according to consistent rowsets
This is an automated email from the ASF dual-hosted git repository.
w41ter pushed a commit to branch fix_snapshot_binlog_files
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 4254a77c40d6f3502099637c4a43c9ab9ed53990
Author: w41ter <w4...@gmail.com>
AuthorDate: Thu Sep 26 01:50:39 2024 +0000
[fix](snapshot) Link binlog files according to consistent rowsets
In previous implementations, binlog files would be linked according to
making snapshot request. However, sometimes not all requests can be
executed directly. For example, when a certain version in
missing_version does not exist, it will fallback to full snapshot.
Therefore, it is correct to link binlog files according to consistent
rowsets.
---
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 e0bfaf704dd..2cfa9a8e8b7 100644
--- a/be/src/olap/snapshot_manager.cpp
+++ b/be/src/olap/snapshot_manager.cpp
@@ -411,13 +411,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.
@@ -628,17 +628,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: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org