apache/hadoop · error · UnsupportedOperationException

No DFS available in child filesystems

Error message

No DFS available in child filesystems

What it means

getECTopologyResultForPolicies on ViewDistributedFileSystem queries each child filesystem for EC policy support and keeps the last supported result; it returns early when any child reports the policies unsupported. result stays null only when the loop never reached a DistributedFileSystem, which then throws UnsupportedOperationException ('No DFS available in child filesystems').

Source

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

    List<IOException> failedExceptions = new ArrayList<>();
    ECTopologyVerifierResult result = null;
    for (FileSystem fs : getChildFileSystems()) {
      if (!(fs instanceof DistributedFileSystem)) {
        continue;
      }
      DistributedFileSystem dfs = (DistributedFileSystem) fs;
      try {
        result = dfs.getECTopologyResultForPolicies(policyNames);
        if (!result.isSupported()) {
          // whenever we see negative result.
          return result;
        }
      } catch (IOException ioe) {
        failedExceptions.add(ioe);
      }
    }
    if (result == null) {
      throw new UnsupportedOperationException(
          "No DFS available in child filesystems");
    }
    if (failedExceptions.size() > 0) {
      throw MultipleIOException.createIOException(failedExceptions);
    }
    // Let's just return the last one.
    return result;
  }

  @Override
  public Path getTrashRoot(Path path) {
    if (this.vfs == null) {
      return super.getTrashRoot(path);
    }
    return this.vfs.getTrashRoot(path);
  }

  @Override

View on GitHub (pinned to 2add963021)

Solutions

  1. Point the topology check at the concrete hdfs:// nameservice URI via DistributedFileSystem or HdfsAdmin.
  2. Ensure the viewfs mount table contains the hdfs:// mounts the EC policies are checked against.
  3. Remember the semantics: a negative EC-topology result from any HDFS child returns normally — only a total absence of HDFS children throws.

Example fix

// before
ECTopologyVerifierResult r =
    viewFs.getECTopologyResultForPolicies(policyNames); // UnsupportedOperationException

// after
try (DistributedFileSystem dfs =
         (DistributedFileSystem) FileSystem.get(new URI("hdfs://ns1"), conf)) {
  ECTopologyVerifierResult r = dfs.getECTopologyResultForPolicies(policyNames);
}
Defensive patterns

Strategy: validation

Validate before calling

boolean hasHdfsChild = viewFs.getChildFileSystems().stream()
    .anyMatch(c -> c instanceof DistributedFileSystem);
if (!hasHdfsChild) {
  // skip the RPC entirely; report 'EC topology unknown: no HDFS mounts'
  return ECTopologyCheckResult.unknown("viewfs has no HDFS children");
}

Type guard

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

Try / catch

try {
  result = viewFs.getECTopologyResultForPolicies(policyNames);
} catch (UnsupportedOperationException e) {
  // no HDFS child: degrade to 'unknown' instead of failing the pre-flight check
  result = ECTopologyVerifierResult.newUnsupported("No HDFS mount in viewfs");
}

Prevention

When it happens

Trigger: Calling getECTopologyResultForPolicies(policyNames) on a viewfs instance whose mount table has no HDFS children; note that a child DFS that answers (even negatively) is not this error — this throw means every child was a non-HDFS filesystem.

Common situations: Pre-flight EC compatibility checks run against the viewfs URI in mixed filesystem namespaces; mount tables where HDFS mounts were replaced by object-store mounts during migrations; tooling that uses fs.defaultFS blindly for topology checks.

Related errors


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