apache/hadoop · error · NotInMountpointException
getDefaultReplication on path `<f>' is not within a mount po
Error message
getDefaultReplication on path `<f>' is not within a mount point
What it means
ViewFileSystem.getDefaultReplication(Path) resolves the path through the mount table; a FileNotFoundException from resolve() (path not under any mount link) is translated into NotInMountpointException('getDefaultReplication on path ... is not within a mount point'). Replication is a property of the target HDFS, so viewfs cannot answer for unmounted paths.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java:987
InodeTree.ResolveResult<FileSystem> res =
fsState.resolve(getUriPath(f), true);
return res.targetFileSystem.getDefaultBlockSize(res.remainingPath);
} catch (FileNotFoundException e) {
throw new NotInMountpointException(f, "getDefaultBlockSize");
} catch (IOException e) {
throw new RuntimeException("Not able to initialize fs in "
+ " getDefaultBlockSize for path " + f + " with exception", e);
}
}
@Override
public short getDefaultReplication(Path f) {
try {
InodeTree.ResolveResult<FileSystem> res =
fsState.resolve(getUriPath(f), true);
return res.targetFileSystem.getDefaultReplication(res.remainingPath);
} catch (FileNotFoundException e) {
throw new NotInMountpointException(f, "getDefaultReplication");
} catch (IOException e) {
throw new RuntimeException("Not able to initialize fs in "
+ " getDefaultReplication for path " + f + " with exception", e);
}
}
@Override
public FsServerDefaults getServerDefaults(Path f) throws IOException {
try {
InodeTree.ResolveResult<FileSystem> res =
fsState.resolve(getUriPath(f), true);
return res.targetFileSystem.getServerDefaults(res.remainingPath);
} catch (FileNotFoundException e) {
throw new NotInMountpointException(f, "getServerDefaults");
}
}
@OverrideView on GitHub (pinned to 2add963021)
Solutions
- Mount the directory in question, e.g. add fs.viewfs.mounttable.default.link.<name>=<target>
- Point the replication query at a path that is already mounted (check with `hadoop fs -ls viewfs://cluster/`)
- Add linkMergeSlash to cover the whole namespace: fs.viewfs.mounttable.default.linkMergeSlash=hdfs://nameservice1/
- Catch NotInMountpointException and fall back to the target cluster's dfs.replication value
Example fix
// before
short rep = fs.getDefaultReplication(new Path("/staging")); // throws if /staging not mounted
// after
short rep;
try {
rep = fs.getDefaultReplication(new Path("/staging"));
} catch (NotInMountpointException e) {
rep = (short) conf.getInt("dfs.replication", 3);
} Defensive patterns
Strategy: try-catch
Validate before calling
// Ensure the replication query targets a mounted prefix
static boolean replicationPathSafe(Configuration conf, Path p) {
return conf.get("fs.viewfs.mounttable.default.linkMergeSlash") != null
|| isMounted(conf, p); // see getDefaultBlockSize guard
} Try / catch
try {
short rep = fs.getDefaultReplication(p);
} catch (NotInMountpointException e) {
short rep = (short) conf.getInt("dfs.replication", 3);
} Prevention
- Mount output/staging directories so replication queries on them resolve
- Cache replication defaults from the target cluster once instead of querying per path
- Include replication-default queries in viewfs migration test suites
When it happens
Trigger: Calling getDefaultReplication(path) where path resolves to an internal mount-table directory ('/' or a parent of mounts such as /data when only /data/hdfs is linked), or where the path prefix matches no configured fs.viewfs.mounttable.default.link.* entry.
Common situations: Output committers and writers that ask for default replication of the output directory when the output dir is not in the mount table; incomplete mount tables after a viewfs cutover; tests using viewfs URIs with a minimal config.
Related errors
- ViewFs: Non absolute mount name in config:{src}
- Path {nextInode.fullPath} already exists as link
- Path {strB} already exists as dir; cannot create link here
- Unexpected mount table link entry '{key}'. Use linkMergeSlas
- ViewFs: Cannot initialize: Invalid entry in Mount table in c
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/ae86cb11bd4ba8f3.
Report an issue: GitHub.