{"record":{"id":"101107b081880eeb","repo":"apache/hadoop","slug":"getdefaultblocksize-on-path-f-is-not-within-a","errorCode":null,"errorMessage":"getDefaultBlockSize on path `<f>' is not within a mount point","messagePattern":"getDefaultBlockSize on path `<f>' is not within a mount point","errorType":"exception","errorClass":"NotInMountpointException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java","lineNumber":973,"sourceCode":"\n  @Override\n  public short getDefaultReplication() {\n    throw new NotInMountpointException(\"getDefaultReplication\");\n  }\n\n  @Override\n  public FsServerDefaults getServerDefaults() throws IOException {\n    throw new NotInMountpointException(\"getServerDefaults\");\n  }\n\n  @Override\n  public long getDefaultBlockSize(Path f) {\n    try {\n      InodeTree.ResolveResult<FileSystem> res =\n        fsState.resolve(getUriPath(f), true);\n      return res.targetFileSystem.getDefaultBlockSize(res.remainingPath);\n    } catch (FileNotFoundException e) {\n      throw new NotInMountpointException(f, \"getDefaultBlockSize\");\n    } catch (IOException e) {\n      throw new RuntimeException(\"Not able to initialize fs in \"\n          + \" getDefaultBlockSize for path \" + f + \" with exception\", e);\n    }\n  }\n\n  @Override\n  public short getDefaultReplication(Path f) {\n    try {\n      InodeTree.ResolveResult<FileSystem> res =\n        fsState.resolve(getUriPath(f), true);\n      return res.targetFileSystem.getDefaultReplication(res.remainingPath);\n    } catch (FileNotFoundException e) {\n      throw new NotInMountpointException(f, \"getDefaultReplication\");\n    } catch (IOException e) {\n      throw new RuntimeException(\"Not able to initialize fs in \"\n          + \" getDefaultReplication for path \" + f + \" with exception\", e);\n    }","sourceCodeStart":955,"sourceCodeEnd":991,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java#L955-L991","documentation":"ViewFileSystem.getDefaultBlockSize(Path) first resolves the path through the mount table (fsState.resolve). When resolution ends in a FileNotFoundException - the path is not covered by any configured mount link - the code translates it into NotInMountpointException(\"getDefaultBlockSize\", f), an UnsupportedOperationException. The block size of a path is a property of the target file system, so viewfs cannot answer for unmounted paths.","triggerScenarios":"Calling getDefaultBlockSize(new Path(\"/tmp\")) when no fs.viewfs.mounttable.default.link.tmp entry exists; calling it on \"/\" or on a mount-table-only internal directory (e.g. /data when only /data/hdfs is mounted); typos in the path that fall outside every mount prefix.","commonSituations":"Cluster migration to viewfs where the old absolute paths (/tmp, /user, /data) were not all added to the mount table; jobs assuming /tmp exists; mount table loaded from a config file that is not on the client classpath so the table is effectively empty.","solutions":["Add the missing mount entry, e.g. fs.viewfs.mounttable.default.link.tmp=/tmp on the target cluster in core-site.xml","Call getDefaultBlockSize on a path that is already known to be mounted (verify with `hadoop fs -ls viewfs://cluster/`)","Add fs.viewfs.mounttable.default.linkMergeSlash=hdfs://nameservice1/ so every path resolves to a real file system","Catch NotInMountpointException in generic tooling and fall back to the target cluster's dfs.blocksize"],"exampleFix":"<!-- before: /tmp not mounted, getDefaultBlockSize(new Path(\"/tmp\")) throws -->\n<property>\n  <name>fs.viewfs.mounttable.default.link.data</name>\n  <value>hdfs://nameservice1/data</value>\n</property>\n\n<!-- after: add the tmp mount -->\n<property>\n  <name>fs.viewfs.mounttable.default.link.tmp</name>\n  <value>hdfs://nameservice1/tmp</value>\n</property>","handlingStrategy":"validation","validationCode":"// Verify the path prefix is covered by a configured mount before asking for block size\nstatic boolean isMounted(Configuration conf, Path p) {\n  String path = Path.getPathWithoutSchemeAndAuthority(p).toString();\n  if (conf.get(\"fs.viewfs.mounttable.default.linkMergeSlash\") != null) return true;\n  for (Map.Entry<String,String> e : conf) {\n    String k = e.getKey();\n    if (k.startsWith(\"fs.viewfs.mounttable.default.link.\")\n        && (\"/\" + path).startsWith(k.substring(\"fs.viewfs.mounttable.default.link.\".length()))) {\n      return true;\n    }\n  }\n  return false;\n}","typeGuard":null,"tryCatchPattern":"try {\n  long bs = fs.getDefaultBlockSize(p);\n} catch (NotInMountpointException e) {\n  // p not covered by the mount table: mount it or use cluster default\n  long bs = conf.getLongBytes(\"dfs.blocksize\", 128L * 1024 * 1024);\n}","preventionTips":["Keep a checklist of every absolute path jobs use (/tmp, /user, /data) and mirror each as a link in the mount table","Smoke-test mounts after config changes: `hadoop fs -ls viewfs://cluster/` must show every expected dir","Never assume '/' or parent dirs resolve; only rely on configured leaf mounts"],"tags":["viewfs","hadoop","mount-table","block-size","configuration"],"backgroundTag":"viewfs-not-in-mountpoint","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}