branch-2.1: [fix](restore) correct the storage_medium of atomic restore #49330 (#49451)

Cherry-picked from #49330

Co-authored-by: walter <maochuan@selectdb.com>
This commit is contained in:
github-actions[bot]
2025-03-29 09:00:26 +08:00
committed by GitHub
parent f55055096b
commit e8c91dcd73

View File

@ -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;
}
}
}