apache/hadoop · error · UnsupportedOperationException

No DFS available in child file systems.

Error message

No DFS available in child file systems.

What it means

ViewDistributedFileSystem.modifyCacheDirective(info) fans the call out to all child filesystems. If none is a DistributedFileSystem it throws UnsupportedOperationException("No DFS available in child file systems."); if some children are DFS but their calls fail, failures are aggregated into MultipleIOException.

Solutions

  1. Invoke modifyCacheDirective on the concrete DistributedFileSystem of the target cluster
  2. Ensure at least one HDFS mount exists if the view-level cache API must work
  3. Catch UnsupportedOperationException to detect a DFS-less view configuration early
Defensive patterns

Strategy: validation

Validate before calling

DistributedFileSystem dfs = findChildDfs(vfs);
if (dfs == null) {
  throw new UnsupportedOperationException(
      "no HDFS child; call modifyCacheDirective on the target cluster");
}
dfs.modifyCacheDirective(info);

Type guard

static boolean hasDfsChild(FileSystem fs) {
  return fs instanceof DistributedFileSystem
      || (fs instanceof ViewDistributedFileSystem
          && ((ViewDistributedFileSystem) fs).getChildFileSystems().stream()
              .anyMatch(c -> c instanceof DistributedFileSystem));
}

Try / catch

try {
  vfs.modifyCacheDirective(info);
} catch (UnsupportedOperationException e) {
  if ("No DFS available in child file systems.".equals(e.getMessage())) {
    dfs.modifyCacheDirective(info); // route to concrete cluster
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Calling modifyCacheDirective on a ViewHDFS instance whose mounts are all non-HDFS (object stores or local filesystem), so getChildFileSystems() yields no DistributedFileSystem.

Common situations: Centralized caching scripts run against a viewfs URI with no HDFS mounts; mixed mount tables where admins expect cache APIs to work on a non-DFS default.

Related errors


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

Appendix: source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ViewDistributedFileSystem.java:1260

    // No path available in CacheDirectiveInfo, Let's shoot to all child fs.
    List<IOException> failedExceptions = new ArrayList<>();
    boolean isDFSExistsInChilds = false;

    for (FileSystem fs : getChildFileSystems()) {
      if (!(fs instanceof DistributedFileSystem)) {
        continue;
      }
      isDFSExistsInChilds = true;
      DistributedFileSystem dfs = (DistributedFileSystem) fs;
      try {
        dfs.modifyCacheDirective(info);
      } catch (IOException ioe) {
        failedExceptions.add(ioe);
      }
    }
    if (!isDFSExistsInChilds) {
      throw new UnsupportedOperationException(
          "No DFS available in child file systems.");
    }
    if (failedExceptions.size() > 0) {
      throw MultipleIOException.createIOException(failedExceptions);
    }
  }

  @Override
  public void modifyCacheDirective(CacheDirectiveInfo info,
      EnumSet<CacheFlag> flags) throws IOException {
    if (this.vfs == null) {
      super.modifyCacheDirective(info, flags);
      return;
    }
    if (info.getPath() != null) {
      ViewFileSystemOverloadScheme.MountPathInfo<FileSystem> mountPathInfo =
          this.vfs.getMountPathInfo(info.getPath(), getConf());
      checkDFS(mountPathInfo.getTargetFs(), "modifyCacheDirective");

View on GitHub (pinned to 2add963021)