yangzhg commented on a change in pull request #8553:
URL: https://github.com/apache/incubator-doris/pull/8553#discussion_r831849788
##########
File path: fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java
##########
@@ -1189,14 +1229,39 @@ private void selectTabletsForBalance() {
for (TabletSchedCtx tabletCtx : alternativeTablets) {
addTablet(tabletCtx, false);
}
+ if (Config.disable_disk_balance) {
+ LOG.info("disk balance is disabled. skip selecting tablets for
disk balance");
+ return;
+ }
+ List<TabletSchedCtx> diskBalanceTablets = Lists.newArrayList();
+ // if default rebalancer can not get new task or user given prio BEs,
then use disk rebalancer to get task
+ if (diskRebalancer.hasPrioBackends() || alternativeTablets.isEmpty()) {
+ diskBalanceTablets = diskRebalancer.selectAlternativeTablets();
+ }
+ for (TabletSchedCtx tabletCtx : diskBalanceTablets) {
+ // add if task from prio backend or cluster is balanced
+ if (alternativeTablets.isEmpty() || tabletCtx.getOrigPriority() ==
TabletSchedCtx.Priority.NORMAL) {
+ addTablet(tabletCtx, false);
+ }
+ }
}
/**
* Try to create a balance task for a tablet.
*/
private void doBalance(TabletSchedCtx tabletCtx, AgentBatchTask batchTask)
throws SchedException {
stat.counterBalanceSchedule.incrementAndGet();
- rebalancer.createBalanceTask(tabletCtx, backendsWorkingSlots,
batchTask);
+ AgentTask task = null;
+ if (tabletCtx.getBalanceType() ==
TabletSchedCtx.BalanceType.DISK_BALANCE) {
+ task = diskRebalancer.createBalanceTask(tabletCtx,
backendsWorkingSlots);
+ checkDiskBalanceLastSuccTime(tabletCtx.getSrcBackendId(),
tabletCtx.getSrcPathHash());
+ checkDiskBalanceLastSuccTime(tabletCtx.getDestBackendId(),
tabletCtx.getDestPathHash());
+ } else if (tabletCtx.getBalanceType() ==
TabletSchedCtx.BalanceType.BE_BALANCE) {
+ task = rebalancer.createBalanceTask(tabletCtx,
backendsWorkingSlots);
+ } else {
+ throw new SchedException(Status.SCHEDULE_FAILED, "unknown balance
type");
Review comment:
it better to print tabletCtx.getBalanceType() in log
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]