apache/hadoop · error · UnsupportedOperationException

disallowSnapshot is not supported for HttpFs on {0}. Please

Error message

disallowSnapshot is not supported for HttpFs on {0}. Please check your fs.defaultFS configuration

What it means

FSOperations.FSDisallowSnapshot.execute() implements DISALLOWSNAPSHOT only for DistributedFileSystem, because reverting a snapshottable directory is an HDFS-specific RPC with no generic FileSystem API. When the HttpFS server's backing filesystem (from its fs.defaultFS) is not HDFS, it throws UnsupportedOperationException (surfaced to REST clients as HTTP 400 with this message).

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/FSOperations.java:1745

     * Creates a disallowSnapshot executor.
     * @param path directory path to allow snapshot.
     */
    public FSDisallowSnapshot(String path) {
      this.path = new Path(path);
    }

    /**
     * Executes the filesystem operation.
     * @param fs filesystem instance to use.
     * @throws IOException thrown if an IO error occurred.
     */
    @Override
    public Void execute(FileSystem fs) throws IOException {
      if (fs instanceof DistributedFileSystem) {
        DistributedFileSystem dfs = (DistributedFileSystem) fs;
        dfs.disallowSnapshot(path);
      } else {
        throw new UnsupportedOperationException("disallowSnapshot is not "
            + "supported for HttpFs on " + fs.getClass()
            + ". Please check your fs.defaultFS configuration");
      }
      return null;
    }
  }

  /**
   *  Executor that performs a createSnapshot FileSystemAccess operation.
   */
  @InterfaceAudience.Private
  public static class FSCreateSnapshot implements
      FileSystemAccess.FileSystemExecutor<String> {

    private Path path;
    private String snapshotName;

    /**

View on GitHub (pinned to 2add963021)

Solutions

  1. Configure fs.defaultFS=hdfs://<nameservice> in the HttpFS server's configuration and restart it
  2. Confirm the loaded server config (httpfs-site.xml) rather than an inherited core-site with a non-HDFS default
  3. Use WebHDFS directly against the NameNode if the HttpFS proxy cannot be reconfigured
  4. Gate snapshot-management calls on a deployment capability check if the same code targets mixed backing stores

Example fix

<!-- before: httpfs-site.xml -->
<property><name>fs.defaultFS</name><value>s3a://bucket</value></property>
<!-- after -->
<property><name>fs.defaultFS</name><value>hdfs://ns1</value></property>
<!-- restart HttpFS so DISALLOWSNAPSHOT reaches DistributedFileSystem -->
Defensive patterns

Strategy: try-catch

Type guard

static DistributedFileSystem asDfs(FileSystem fs) {
  return fs instanceof DistributedFileSystem ? (DistributedFileSystem) fs : null;
}

Try / catch

try {
  fs.disallowSnapshot(path);
} catch (IOException e) {
  if (e.getMessage() != null && e.getMessage().contains("not supported for HttpFs")) {
    LOG.warn("HttpFS not HDFS-backed; cannot disallowSnapshot({})", path);
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Client sends op=DISALLOWSNAPSHOT via webhdfs:// while HttpFS proxies to a non-HDFS filesystem (local, s3a, abfs, viewfs).

Common situations: HttpFS gateway fronting object storage; httpfs-site.xml fs.defaultFS unset so LocalFileSystem is used; environment drift between dev (local FS) and prod (HDFS) exposing the call only in dev.

Related errors


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