This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new e8c91dcd73a branch-2.1: [fix](restore) correct the storage_medium of 
atomic restore #49330 (#49451)
e8c91dcd73a is described below

commit e8c91dcd73a3baa317a06bb869812408ea97cee5
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Mar 29 09:00:26 2025 +0800

    branch-2.1: [fix](restore) correct the storage_medium of atomic restore 
#49330 (#49451)
    
    Cherry-picked from #49330
    
    Co-authored-by: walter <maoch...@selectdb.com>
---
 .../src/main/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 f310ff1e7ca..d812b6b18f4 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;
         }
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to