@@ -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(
323325Status 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
0 commit comments