apache/hadoop · error · AccessControlException
Router federation rename can't rename snapshot path. dst={}(
Error message
Router federation rename can't rename snapshot path. dst={}({}) What it means
Companion to the src check: RouterFederationRename.checkSnapshotPath also rejects a rename whose destination path addresses something inside a snapshot, i.e. the dst RemoteLocation destination contains '/.snapshot/'. Writing into a snapshot path is invalid in HDFS itself, and the fed rename pre-check surfaces it as an AccessControlException before any job is submitted.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterFederationRename.java:198
new Path("hdfs://" + srcLoc.getNameserviceId() + srcLoc.getDest());
srcPath.getFileSystem(conf).access(srcPath.getParent(), FsAction.WRITE);
// check dst path permission.
Path dstPath =
new Path("hdfs://" + dstLoc.getNameserviceId() + dstLoc.getDest());
dstPath.getFileSystem(conf).access(dstPath.getParent(), FsAction.WRITE);
}
static void checkSnapshotPath(RemoteLocation src, RemoteLocation dst)
throws AccessControlException {
if (src.getDest()
.contains(HdfsConstants.SEPARATOR_DOT_SNAPSHOT_DIR + Path.SEPARATOR)) {
throw new AccessControlException(
"Router federation rename can't rename snapshot path. src=" + src
.getSrc() + "(" + src + ")");
}
if (dst.getDest()
.contains(HdfsConstants.SEPARATOR_DOT_SNAPSHOT_DIR + Path.SEPARATOR)) {
throw new AccessControlException(
"Router federation rename can't rename snapshot path. dst=" + dst
.getSrc() + "(" + dst + ")");
}
}
/**
* Build router federation rename job moving data from src to dst.
* @param srcNs the source namespace id.
* @param dstNs the dst namespace id.
* @param src the source path.
* @param dst the dst path.
*/
private BalanceJob buildRouterRenameJob(String srcNs, String dstNs,
String src, String dst) throws IOException {
checkConfiguration(conf);
Path srcPath = new Path("hdfs://" + srcNs + src);
Path dstPath = new Path("hdfs://" + dstNs + dst);
boolean forceCloseOpen =View on GitHub (pinned to 2add963021)
Solutions
- Target a live writable directory as the destination, never a path containing /.snapshot/
- Validate dst before issuing the rename: reject any path with a /.snapshot/ component client-side
- If the intent was restoring snapshot content, copy out of the snapshot with distcp to a regular destination instead
Example fix
# before hdfs dfs -fs hdfs://router -mv /src /dstmount/.snapshot/snap1/restored # after hdfs dfs -fs hdfs://router -mv /src /dstmount/restored
Defensive patterns
Strategy: validation
Validate before calling
// Validate the destination before rename
if (dst.contains(HdfsConstants.SEPARATOR_DOT_SNAPSHOT_DIR + Path.SEPARATOR)) {
throw new IllegalArgumentException("Cannot rename into snapshot path: " + dst);
} Type guard
boolean isSnapshotPath(String path) {
return path != null && path.contains("/.snapshot/");
} Try / catch
try {
dfs.rename(src, dst);
} catch (AccessControlException ace) {
if (ace.getMessage() != null && ace.getMessage().contains("can't rename snapshot path. dst=")) {
// choose a live writable directory as destination
}
throw ace;
} Prevention
- Build destination paths from trusted live-directory inputs, never from snapshot listings
- Block /.snapshot/ in any path-building helper your tooling uses for write APIs
- Treat .snapshot as reserved: reject it in client-side path validators
When it happens
Trigger: rename(src, dst) across namespaces where the resolved dst contains /.snapshot/ - for example renaming onto /mount/.snapshot/snap1/newname or any target beneath a .snapshot directory.
Common situations: Scripts that construct destination paths from snapshot listings; mistaken cut-and-paste of a snapshot path as the rename target; tooling unaware that .snapshot is reserved.
Related errors
- Router federation rename can't rename snapshot path. src={}(
- Rename of {} to {} is not allowed, no eligible destination i
- Rename of {} to {} is not allowed. The remote location shoul
- Rename of {} to {} failed.
- Permission denied rename {}({}) to {}({}) Reason={}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/2ceb0c17d35d09d9.
Report an issue: GitHub.