apache/hadoop · error · IOException

{src} shouldn't enable snapshot.

Error message

{src} shouldn't enable snapshot.

What it means

The third clause of DistCpProcedure.preCheck(): fedbalance rejects a source that already has snapshots enabled, detected via existence of src/.snapshot (HdfsConstants.DOT_SNAPSHOT_DIR). The procedure needs full control of snapshots on src (pathCheckBeforeInitDistcp calls allowSnapshot(src) and later creates its own CURRENT/LAST snapshots for diff distcp), so pre-existing snapshot state is refused up front.

Source

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

      return true;
    default:
      throw new IOException("Unexpected stage=" + stage);
    }
  }

  /**
   * Pre check of src and dst.
   */
  void preCheck() throws IOException {
    FileStatus status = srcFs.getFileStatus(src);
    if (!status.isDirectory()) {
      throw new IOException(src + " should be a directory.");
    }
    if (dstFs.exists(dst)) {
      throw new IOException(dst + " already exists.");
    }
    if (srcFs.exists(new Path(src, HdfsConstants.DOT_SNAPSHOT_DIR))) {
      throw new IOException(src + " shouldn't enable snapshot.");
    }
    updateStage(Stage.INIT_DISTCP);
  }

  /**
   * The initial distcp. Copying src to dst.
   */
  void initDistCp() throws IOException, RetryException {
    RunningJobStatus job = getCurrentJob();
    if (job != null) {
      // the distcp has been submitted.
      if (job.isComplete()) {
        jobId = null; // unset jobId because the job is done.
        if (job.isSuccessful()) {
          updateStage(Stage.DIFF_DISTCP);
          return;
        } else {
          LOG.warn("DistCp failed. Failure={}", job.getFailureInfo());

View on GitHub (pinned to 2add963021)

Solutions

  1. Delete all snapshots on src ('hdfs dfsadmin -deleteSnapshot <src> <name>' for each) and then 'hdfs dfsadmin -disallowSnapshot <src>'.
  2. Resubmit the fedbalance job once 'hdfs dfs -ls <src>/.snapshot' fails (snapshot state fully removed).
  3. If snapshots must stay enabled for backups, balance a different tree or restructure so the balanced subtree is not snapshottable.

Example fix

# before
hdfs fedbalance -src hdfs://ns1/data -dst hdfs://ns2/data   # /data is snapshottable

# after
hdfs dfs -ls hdfs://ns1/data/.snapshot          # list existing snapshots
hdfs dfsadmin -deleteSnapshot hdfs://ns1/data snap1
hdfs dfsadmin -disallowSnapshot hdfs://ns1/data
hdfs fedbalance -src hdfs://ns1/data -dst hdfs://ns2/data
Defensive patterns

Strategy: validation

Validate before calling

Path src = new Path("hdfs://ns1/data");
FileSystem srcFs = src.getFileSystem(conf);
if (srcFs.exists(new Path(src, ".snapshot"))) {
  throw new IllegalStateException("src is snapshottable/has snapshots; delete snapshots and disallowSnapshot before fedbalance");
}

Prevention

When it happens

Trigger: Submitting a fedbalance job where src is a snapshottable directory or has any snapshot: srcFs.exists(new Path(src, '.snapshot')) returns true in preCheck().

Common situations: Balancing directories already covered by snapshot-based backup jobs; leftover fedbalance snapshots from an aborted earlier run; dirs made snapshottable by admin tooling for DR purposes.

Related errors


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