apache/hadoop · error · IOException

Failed delete {src}

Error message

Failed delete {src}

What it means

The DELETE branch of TrashProcedure.moveToTrash(): srcFs.delete(src, true) returned false rather than throwing, which the code converts into IOException. Hadoop's FileSystem.delete signals many failures via the boolean, so this means the recursive delete did not succeed even though src existed a moment earlier. As with 5051, the balance copy has already completed - only source removal failed.

Source

Thrown at hadoop-tools/hadoop-federation-balance/src/main/java/org/apache/hadoop/tools/fedbalance/TrashProcedure.java:82

  }

  /**
   * Delete source path to trash.
   */
  void moveToTrash() throws IOException {
    Path src = context.getSrc();
    if (srcFs.exists(src)) {
      TrashOption trashOption = context.getTrashOpt();
      switch (trashOption) {
      case TRASH:
        conf.setFloat(FS_TRASH_INTERVAL_KEY, 60);
        if (!Trash.moveToAppropriateTrash(srcFs, src, conf)) {
          throw new IOException("Failed move " + src + " to trash.");
        }
        break;
      case DELETE:
        if (!srcFs.delete(src, true)) {
          throw new IOException("Failed delete " + src);
        }
        LOG.info("{} is deleted.", src);
        break;
      case SKIP:
        break;
      default:
        throw new IOException("Unexpected trash option=" + trashOption);
      }
    }
  }

  public FedBalanceContext getContext() {
    return context;
  }

  @Override
  public void write(DataOutput out) throws IOException {
    super.write(out);

View on GitHub (pinned to 2add963021)

Solutions

  1. Re-check whether src still exists; if it is already gone the intended end state is reached and the error can be ignored.
  2. Verify the balance user has write permission on src's parent directory (needed to remove the entry).
  3. Retry the procedure, or delete manually with 'hdfs dfs -rm -r <src>' after confirming dst is complete and consistent.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  // DELETE disposal stage of TrashProcedure
} catch (IOException e) {
  if (e.getMessage() != null && e.getMessage().startsWith("Failed delete")) {
    // re-check existence: if src is gone the goal is achieved; else fix permissions and retry
  }
}

Prevention

When it happens

Trigger: delete(src, recursive=true) returning false: the path disappeared between the exists() check and the delete (race with another process), the user lacks permission to remove entries in src's parent, or the FileSystem implementation reports failure without an exception.

Common situations: Another job (compaction, cleaner, operator) deleting src concurrently; permission edge cases on the parent directory; running the balance user without delete rights on that subtree.

Related errors


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