[improvement](disk migration) disk migration skip cooldown tablets (#27807)

This commit is contained in:
yujun
2023-12-03 23:05:52 +08:00
committed by GitHub
parent a64656748b
commit e2d5532e3f

View File

@ -18,10 +18,7 @@
package org.apache.doris.clone;
import org.apache.doris.catalog.CatalogRecycleBin;
import org.apache.doris.catalog.DataProperty;
import org.apache.doris.catalog.Database;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.OlapTable;
import org.apache.doris.catalog.Replica;
import org.apache.doris.catalog.TabletInvertedIndex;
import org.apache.doris.catalog.TabletMeta;
@ -33,8 +30,8 @@ import org.apache.doris.clone.TabletScheduler.PathSlot;
import org.apache.doris.common.FeConstants;
import org.apache.doris.system.SystemInfoService;
import org.apache.doris.thrift.TStorageMedium;
import org.apache.doris.thrift.TUniqueId;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@ -222,6 +219,12 @@ public class DiskRebalancer extends Rebalancer {
continue;
}
// backend not support migrate cooldown tablets
TUniqueId cooldownMetaId = replica.getCooldownMetaId();
if (cooldownMetaId != null && (cooldownMetaId.getLo() != 0 || cooldownMetaId.getHi() != 0)) {
continue;
}
// check if replica's is on 'high' path.
// and only select it if the selected tablets num of this path
// does not exceed the limit (BALANCE_SLOT_NUM_FOR_PATH).
@ -303,21 +306,6 @@ public class DiskRebalancer extends Rebalancer {
if (replica.getDataSize() == 0) {
throw new SchedException(Status.UNRECOVERABLE, SubCode.DIAGNOSE_IGNORE, "size of src replica is zero");
}
Database db = Env.getCurrentInternalCatalog().getDbOrException(tabletCtx.getDbId(),
s -> new SchedException(Status.UNRECOVERABLE, SubCode.DIAGNOSE_IGNORE,
"db " + tabletCtx.getDbId() + " does not exist"));
OlapTable tbl = (OlapTable) db.getTableOrException(tabletCtx.getTblId(),
s -> new SchedException(Status.UNRECOVERABLE, SubCode.DIAGNOSE_IGNORE,
"tbl " + tabletCtx.getTblId() + " does not exist"));
DataProperty dataProperty = tbl.getPartitionInfo().getDataProperty(tabletCtx.getPartitionId());
if (dataProperty == null) {
throw new SchedException(Status.UNRECOVERABLE, "data property is null");
}
String storagePolicy = dataProperty.getStoragePolicy();
if (!Strings.isNullOrEmpty(storagePolicy)) {
throw new SchedException(Status.UNRECOVERABLE, SubCode.DIAGNOSE_IGNORE,
"disk balance not support for cooldown storage");
}
// check src slot
PathSlot slot = backendsWorkingSlots.get(replica.getBackendId());