{"record":{"id":"38126e586f750ff3","repo":"apache/hadoop","slug":"no-dfs-available-in-child-filesystems","errorCode":null,"errorMessage":"No DFS available in child filesystems","messagePattern":"No DFS available in child filesystems","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ViewDistributedFileSystem.java","lineNumber":2091,"sourceCode":"    List<IOException> failedExceptions = new ArrayList<>();\n    ECTopologyVerifierResult result = null;\n    for (FileSystem fs : getChildFileSystems()) {\n      if (!(fs instanceof DistributedFileSystem)) {\n        continue;\n      }\n      DistributedFileSystem dfs = (DistributedFileSystem) fs;\n      try {\n        result = dfs.getECTopologyResultForPolicies(policyNames);\n        if (!result.isSupported()) {\n          // whenever we see negative result.\n          return result;\n        }\n      } catch (IOException ioe) {\n        failedExceptions.add(ioe);\n      }\n    }\n    if (result == null) {\n      throw new UnsupportedOperationException(\n          \"No DFS available in child filesystems\");\n    }\n    if (failedExceptions.size() > 0) {\n      throw MultipleIOException.createIOException(failedExceptions);\n    }\n    // Let's just return the last one.\n    return result;\n  }\n\n  @Override\n  public Path getTrashRoot(Path path) {\n    if (this.vfs == null) {\n      return super.getTrashRoot(path);\n    }\n    return this.vfs.getTrashRoot(path);\n  }\n\n  @Override","sourceCodeStart":2073,"sourceCodeEnd":2109,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/ViewDistributedFileSystem.java#L2073-L2109","documentation":"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').","triggerScenarios":"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.","commonSituations":"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.","solutions":["Point the topology check at the concrete hdfs:// nameservice URI via DistributedFileSystem or HdfsAdmin.","Ensure the viewfs mount table contains the hdfs:// mounts the EC policies are checked against.","Remember the semantics: a negative EC-topology result from any HDFS child returns normally — only a total absence of HDFS children throws."],"exampleFix":"// before\nECTopologyVerifierResult r =\n    viewFs.getECTopologyResultForPolicies(policyNames); // UnsupportedOperationException\n\n// after\ntry (DistributedFileSystem dfs =\n         (DistributedFileSystem) FileSystem.get(new URI(\"hdfs://ns1\"), conf)) {\n  ECTopologyVerifierResult r = dfs.getECTopologyResultForPolicies(policyNames);\n}","handlingStrategy":"validation","validationCode":"boolean hasHdfsChild = viewFs.getChildFileSystems().stream()\n    .anyMatch(c -> c instanceof DistributedFileSystem);\nif (!hasHdfsChild) {\n  // skip the RPC entirely; report 'EC topology unknown: no HDFS mounts'\n  return ECTopologyCheckResult.unknown(\"viewfs has no HDFS children\");\n}","typeGuard":"static boolean canCheckEcTopologyThrough(FileSystem fs) {\n  return fs instanceof DistributedFileSystem\n      || (fs instanceof ViewDistributedFileSystem\n          && fs.getChildFileSystems().stream()\n              .anyMatch(c -> c instanceof DistributedFileSystem));\n}","tryCatchPattern":"try {\n  result = viewFs.getECTopologyResultForPolicies(policyNames);\n} catch (UnsupportedOperationException e) {\n  // no HDFS child: degrade to 'unknown' instead of failing the pre-flight check\n  result = ECTopologyVerifierResult.newUnsupported(\"No HDFS mount in viewfs\");\n}","preventionTips":["Run EC topology checks against each concrete nameservice, not the viewfs umbrella.","Treat 'unsupported' as a config finding: audit the mount table before enabling EC on a namespace.","Remember a supported-but-negative result returns normally; only the absence of HDFS children throws."],"tags":["hdfs","viewfs","erasure-coding","topology-check","mount-table"],"backgroundTag":"unsupported-filesystem-operation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}