{"record":{"id":"f2789c6fd5d2157b","repo":"apache/hadoop","slug":"plan-already-in-progress","errorCode":"PLAN_ALREADY_IN_PROGRESS","errorMessage":"Executing another plan","messagePattern":"Executing another plan","errorType":"exception","errorClass":"DiskBalancerException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancer.java","lineNumber":189,"sourceCode":"   * can be executed by the blockMover.\n   *\n   * @param planId      - A SHA-1 of the plan string\n   * @param planVersion - version of the plan string - for future use.\n   * @param planFileName    - Plan file name\n   * @param planData    - Plan data in json format\n   * @param force       - Skip some validations and execute the plan file.\n   * @throws DiskBalancerException\n   */\n  public void submitPlan(String planId, long planVersion, String planFileName,\n                         String planData, boolean force)\n          throws DiskBalancerException {\n    lock.lock();\n    try {\n      checkDiskBalancerEnabled();\n      if ((this.future != null) && (!this.future.isDone())) {\n        LOG.error(\"Disk Balancer - Executing another plan (Plan File: {}, Plan ID: {}), \" +\n            \"submitPlan failed.\", planFile, planID);\n        throw new DiskBalancerException(\"Executing another plan\",\n            DiskBalancerException.Result.PLAN_ALREADY_IN_PROGRESS);\n      }\n      NodePlan nodePlan = verifyPlan(planId, planVersion, planData, force);\n      createWorkPlan(nodePlan);\n      this.planID = planId;\n      this.planFile = planFileName;\n      this.currentResult = Result.PLAN_UNDER_PROGRESS;\n      executePlan();\n    } finally {\n      lock.unlock();\n    }\n  }\n\n  /**\n   * Get FsVolume by volume UUID.\n   * @param fsDataset\n   * @param volUuid\n   * @return FsVolumeSpi","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DiskBalancer.java#L171-L207","documentation":"DiskBalancerException with Result.PLAN_ALREADY_IN_PROGRESS from DiskBalancer.submitPlan: a disk-balancer plan file is being submitted for execution while a previously submitted plan on this DataNode is still running (this.future != null && !this.future.isDone()). The DataNode executes at most one plan at a time under its lock; note that the 'force' flag skips plan validations but NOT this in-progress check.","triggerScenarios":"Running 'hdfs diskbalancer -execute <planfile>' on a node twice, or executing a second plan while the first (which can run for hours at the configured bandwidth) is still copying data between volumes.","commonSituations":"Operators re-running execute because the first invocation 'seemed hung' (slow bandwidth throttling); automation scripts re-submitting on timeout; iterating on plans without checking current status.","solutions":["Check current execution state first: 'hdfs diskbalancer -query <datanode>' shows PLAN_UNDER_PROGRESS with the running planID","Cancel the running plan, then submit the new one: 'hdfs diskbalancer -cancel <runningPlanID>' (or -cancel planID with the node) and wait for it to stop before -execute","Wait for the running plan to finish if it is doing useful work - query again until status leaves PLAN_UNDER_PROGRESS","Set an explicit bandwidth ('hdfs diskbalancer -bandwidth' / dfs.disk.balancer.max.disk.throughput) so plans finish in a predictable window instead of being re-submitted"],"exampleFix":"# before: second execute while plan still running -> PLAN_ALREADY_IN_PROGRESS\nhdfs diskbalancer -execute /system/diskbalancer/<node>-plan.json\nhdfs diskbalancer -execute /system/diskbalancer/<node>-plan-v2.json\n\n# after: query, cancel running plan, then execute the new one\nhdfs diskbalancer -query <datanode>:<ipc_port>          # note running PlanID\nhdfs diskbalancer -cancel <runningPlanID>\nhdfs diskbalancer -execute /system/diskbalancer/<node>-plan-v2.json","handlingStrategy":"validation","validationCode":"// CLI flow: check plan status before executing a new one\n//   hdfs diskbalancer -query <datanode>  -> read PlanStatus / PlanID\n// API sketch:\nDiskBalancerResult status = diskBalancer.getPlanStatus();\nif (status.getResult() == Result.PLAN_UNDER_PROGRESS) {\n  diskBalancer.cancelPlan(status.getPlanID());   // or wait/await completion\n  waitForPlanDone(status.getPlanID());\n}\ndiskBalancer.submitPlan(planId, planVersion, planFile, planData, force);","typeGuard":null,"tryCatchPattern":"try {\n  diskBalancer.submitPlan(planId, version, planFile, planData, force);\n} catch (DiskBalancerException e) {\n  if (e.getResult() == DiskBalancerException.Result.PLAN_ALREADY_IN_PROGRESS) {\n    // query the running plan; cancel it deliberately, then resubmit -\n    // the force flag does NOT bypass this check\n  }\n}","preventionTips":["Always run 'hdfs diskbalancer -query <node>' before -execute; treat IN_PROGRESS as a hard stop","Set an explicit bandwidth for disk balancer so plans complete in a known window and reduce re-submit temptation","Wrap operational scripts with a query-cancel-execute sequence instead of bare execute","Remember 'force' only skips plan validations, never the single-plan-at-a-time rule"],"tags":["hdfs","diskbalancer","plan-execution","concurrency","dfsadmin"],"backgroundTag":"operation-already-in-progress","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}