Skip to content

Commit bfbb1ae

Browse files
committed
fix backup restore
1 parent 86d1008 commit bfbb1ae

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

be/src/storage/snapshot/snapshot_manager.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,9 @@ Result<std::vector<PendingRowsetGuard>> SnapshotManager::convert_rowset_ids(
226226
// src be local rowset
227227
RowsetId rowset_id = _engine.next_rowset_id();
228228
guards.push_back(_engine.pending_local_rowsets().add(rowset_id));
229-
RETURN_IF_ERROR_RESULT(_rename_rowset_id(visible_rowset, clone_dir, tablet_schema,
230-
rowset_id, rowset_meta));
229+
RETURN_IF_ERROR_RESULT(_rename_rowset_id(
230+
visible_rowset, clone_dir, tablet_schema, rowset_id, rowset_meta,
231+
new_tablet_meta_pb.enable_unique_key_merge_on_write()));
231232
RowsetId src_rs_id;
232233
if (visible_rowset.rowset_id() > 0) {
233234
src_rs_id.init(visible_rowset.rowset_id());
@@ -268,8 +269,9 @@ Result<std::vector<PendingRowsetGuard>> SnapshotManager::convert_rowset_ids(
268269
// src be local rowset
269270
RowsetId rowset_id = _engine.next_rowset_id();
270271
guards.push_back(_engine.pending_local_rowsets().add(rowset_id));
271-
RETURN_IF_ERROR_RESULT(_rename_rowset_id(stale_rowset, clone_dir, tablet_schema,
272-
rowset_id, rowset_meta));
272+
RETURN_IF_ERROR_RESULT(_rename_rowset_id(
273+
stale_rowset, clone_dir, tablet_schema, rowset_id, rowset_meta,
274+
new_tablet_meta_pb.enable_unique_key_merge_on_write()));
273275
RowsetId src_rs_id;
274276
if (stale_rowset.rowset_id() > 0) {
275277
src_rs_id.init(stale_rowset.rowset_id());
@@ -323,7 +325,8 @@ Result<std::vector<PendingRowsetGuard>> SnapshotManager::convert_rowset_ids(
323325
Status SnapshotManager::_rename_rowset_id(const RowsetMetaPB& rs_meta_pb,
324326
const std::string& new_tablet_path,
325327
TabletSchemaSPtr tablet_schema, const RowsetId& rowset_id,
326-
RowsetMetaPB* new_rs_meta_pb) {
328+
RowsetMetaPB* new_rs_meta_pb,
329+
bool enable_unique_key_merge_on_write) {
327330
Status st = Status::OK();
328331
RowsetMetaSharedPtr rowset_meta(new RowsetMeta());
329332
rowset_meta->init_from_pb(rs_meta_pb);
@@ -349,6 +352,9 @@ Status SnapshotManager::_rename_rowset_id(const RowsetMetaPB& rs_meta_pb,
349352
context.newest_write_timestamp = org_rowset_meta->newest_write_timestamp();
350353
// keep segments_overlap same as origin rowset
351354
context.segments_overlap = rowset_meta->segments_overlap();
355+
// propagate MOW flag so that non-MOW key-bounds aggregation is not applied
356+
// when restoring a MOW tablet's rowset
357+
context.enable_unique_key_merge_on_write = enable_unique_key_merge_on_write;
352358

353359
auto rs_writer = DORIS_TRY(RowsetFactory::create_rowset_writer(_engine, context, false));
354360

be/src/storage/snapshot/snapshot_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class SnapshotManager {
132132

133133
Status _rename_rowset_id(const RowsetMetaPB& rs_meta_pb, const std::string& new_tablet_path,
134134
TabletSchemaSPtr tablet_schema, const RowsetId& next_id,
135-
RowsetMetaPB* new_rs_meta_pb);
135+
RowsetMetaPB* new_rs_meta_pb, bool enable_unique_key_merge_on_write);
136136

137137
Status _rename_index_ids(TabletSchemaPB& schema_pb,
138138
const TabletSchemaSPtr& tablet_schema) const;

0 commit comments

Comments
 (0)