apache/hadoop · error · DiskBalancerException

NO_SUCH_PLAN

NO_SUCH_PLAN

Error message

No such plan.

What it means

DiskBalancerException with Result.NO_SUCH_PLAN from DiskBalancer.cancelPlan: the cancel request names a planID that does not match the currently known plan - because this.planID is null (no plan ever submitted or node restarted), the submitted ID differs from the running one, or it is empty. Cancel only works against the single plan the DataNode currently holds.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancer.java:276

  }

  /**
   * Cancels a running plan.
   *
   * @param planID - Hash of the plan to cancel.
   * @throws DiskBalancerException
   */
  public void cancelPlan(String planID) throws DiskBalancerException {
    lock.lock();
    boolean needShutdown = false;
    try {
      checkDiskBalancerEnabled();
      if (this.planID == null ||
          !this.planID.equals(planID) ||
          this.planID.isEmpty()) {
        LOG.error("Disk Balancer - No such plan. Cancel plan failed. PlanID: " +
            planID);
        throw new DiskBalancerException("No such plan.",
            DiskBalancerException.Result.NO_SUCH_PLAN);
      }
      if (!this.future.isDone()) {
        this.currentResult = Result.PLAN_CANCELLED;
        this.blockMover.setExitFlag();
        scheduler.shutdown();
        needShutdown = true;
      }
    } finally {
      lock.unlock();
    }
    // no need to hold lock while shutting down executor.
    if (needShutdown) {
      shutdownExecutor();
    }
  }

  /**

View on GitHub (pinned to 2add963021)

Solutions

  1. Query the node for the actual running plan first: 'hdfs diskbalancer -query <datanode>' and read the PlanID field
  2. Cancel using exactly that PlanID: 'hdfs diskbalancer -cancel <PlanID> -node <datanode>'
  3. If the DataNode restarted, the old plan is gone - there is nothing to cancel; submit a fresh plan if rebalancing is still needed
  4. If the plan already finished (query shows done/cancelled state), no cancel is required

Example fix

# before: cancel with stale ID -> NO_SUCH_PLAN
hdfs diskbalancer -cancel 2016-...-old-plan-id

# after: query the node, cancel the ID it actually holds
hdfs diskbalancer -query <datanode>:<ipc_port>
# PlanID: 3f9a...  PlanStatus: IN_PROGRESS
hdfs diskbalancer -cancel 3f9a... -node <datanode>
Defensive patterns

Strategy: validation

Validate before calling

// Resolve the live plan ID before canceling
//   hdfs diskbalancer -query <datanode>
// API sketch:
String currentPlanId = diskBalancer.getPlanStatus().getPlanID();
if (currentPlanId == null || currentPlanId.isEmpty()) {
  // nothing to cancel - plan finished or DN restarted
} else {
  diskBalancer.cancelPlan(currentPlanId);
}

Try / catch

try {
  diskBalancer.cancelPlan(requestedPlanId);
} catch (DiskBalancerException e) {
  if (e.getResult() == DiskBalancerException.Result.NO_SUCH_PLAN) {
    // re-query the node for its actual PlanID (or accept that a restart
    // cleared plan state and there is nothing to cancel)
  }
}

Prevention

When it happens

Trigger: 'hdfs diskbalancer -cancel <id>' with a stale or mistyped planID; cancel after the DataNode restarted (plan state is in-memory and lost); canceling a plan that already completed and was replaced by a null planID.

Common situations: Copy-pasting an old planID from a previous execution; canceling after DN restart (must re-submit, not cancel); canceling the wrong node's plan in federated/multi-DN scripts.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/48a8967e8c0abcc3. Report an issue: GitHub.