From e8c91dcd73a3baa317a06bb869812408ea97cee5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 29 Mar 2025 09:00:26 +0800 Subject: [PATCH] branch-2.1: [fix](restore) correct the storage_medium of atomic restore #49330 (#49451) Cherry-picked from #49330 Co-authored-by: walter --- .../java/org/apache/doris/backup/RestoreJob.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java b/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java index f310ff1e7c..d812b6b18f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java @@ -1183,8 +1183,7 @@ public class RestoreJob extends AbstractJob { localOlapTbl.getName()); } } - tabletBases.put(remoteTablet.getId(), - new TabletRef(localTablet.getId(), schemaHash, storageMedium)); + tabletBases.put(remoteTablet.getId(), new TabletRef(localTablet.getId(), schemaHash)); } } } @@ -1332,8 +1331,11 @@ public class RestoreJob extends AbstractJob { for (Tablet restoreTablet : restoredIdx.getTablets()) { TabletRef baseTabletRef = tabletBases == null ? null : tabletBases.get(restoreTablet.getId()); // All restored replicas will be saved to HDD by default. - TStorageMedium storageMedium = baseTabletRef == null - ? TStorageMedium.HDD : baseTabletRef.storageMedium; + TStorageMedium storageMedium = TStorageMedium.HDD; + if (tabletBases != null) { + // ensure this tablet is bound to the same backend disk as the origin table's tablet. + storageMedium = localTbl.getPartitionInfo().getDataProperty(restorePart.getId()).getStorageMedium(); + } TabletMeta tabletMeta = new TabletMeta(db.getId(), localTbl.getId(), restorePart.getId(), restoredIdx.getId(), indexMeta.getSchemaHash(), storageMedium); Env.getCurrentInvertedIndex().addTablet(restoreTablet.getId(), tabletMeta); @@ -2775,12 +2777,10 @@ public class RestoreJob extends AbstractJob { private static class TabletRef { public long tabletId; public int schemaHash; - public TStorageMedium storageMedium; - TabletRef(long tabletId, int schemaHash, TStorageMedium storageMedium) { + TabletRef(long tabletId, int schemaHash) { this.tabletId = tabletId; this.schemaHash = schemaHash; - this.storageMedium = storageMedium; } } }