Skip balance when colocate group is balancing (#548)

This commit is contained in:
kangkaisen
2019-01-18 14:13:42 +08:00
committed by Mingyu Chen
parent 717285db1e
commit 51c128c8d1
2 changed files with 10 additions and 2 deletions

View File

@ -4066,6 +4066,8 @@ public class Catalog {
tabletMeta.getOldSchemaHash());
tablet.addReplica(replica);
}
Preconditions.checkState(chosenBackendIds.size() == replicationNum, chosenBackendIds.size() + " vs. "+ replicationNum);
}
} else {
throw new DdlException("Unknown distribution type: " + distributionInfoType);
@ -4078,7 +4080,6 @@ public class Catalog {
if (chosenBackendIds == null) {
throw new DdlException("Failed to find enough host in all backends. need: " + replicationNum);
}
Preconditions.checkState(chosenBackendIds.size() == replicationNum);
return chosenBackendIds;
}

View File

@ -17,7 +17,7 @@
package org.apache.doris.clone;
import com.google.common.base.Preconditions;
import org.apache.doris.catalog.Catalog;
import org.apache.doris.catalog.ColocateTableIndex;
import org.apache.doris.catalog.Database;
@ -198,6 +198,11 @@ public class ColocateTableBalancer extends Daemon {
Set<Long> allGroupIds = colocateIndex.getAllGroupIds();
for (Long groupId : allGroupIds) {
if (colocateIndex.isGroupBalancing(groupId)) {
LOG.info("colocate group {} is balancing", groupId);
continue;
}
Database db = catalog.getDb(colocateIndex.getDB(groupId));
List<Long> clusterAliveBackendIds = getAliveClusterBackendIds(db.getClusterName());
Set<Long> allGroupBackendIds = colocateIndex.getBackendsByGroup(groupId);
@ -590,6 +595,8 @@ public class ColocateTableBalancer extends Daemon {
backends.add(cloneReplicaBackendId);
}
Preconditions.checkState(replicateNum == backends.size(), replicateNum + " vs. " + backends.size());
AddMigrationJob(tabletInfo, cloneReplicaBackendId);
}
}