apache/hadoop · error · IOException
Rename of {src} to {dst} is not allowed. The number of remot
Error message
Rename of {src} to {dst} is not allowed. The number of remote locations for both source and target should be same. What it means
Identical guard to the rename variant, but on RouterAsyncClientProtocol.rename2 (rename with Rename options, used by modern clients). Before fanning rename2 out concurrently to all locations of a multi-destination directory, the Router requires srcLocations.size() == locs.size(); a mismatch aborts with IOException naming src and dst. Without the check, concurrent invocation would leave the replicas of the multi-dest tree inconsistently renamed.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/async/RouterAsyncClientProtocol.java:301
rpcServer.getLocationsForPath(src, true, false);
final List<RemoteLocation> dstLocations =
rpcServer.getLocationsForPath(dst, false, false);
// srcLocations may be trimmed by getRenameDestinations()
final List<RemoteLocation> locs = new LinkedList<>(srcLocations);
RemoteParam dstParam = getRenameDestinations(locs, dstLocations);
if (locs.isEmpty()) {
rbfRename.routerFedRename(src, dst, srcLocations, dstLocations);
asyncComplete(null);
return;
}
RemoteMethod method = new RemoteMethod("rename2",
new Class<?>[] {String.class, String.class, options.getClass()},
new RemoteParam(), dstParam, options);
isMultiDestDirectory(src);
asyncApply((AsyncApplyFunction<Boolean, Boolean>) isMultiDestDirectory -> {
if (isMultiDestDirectory) {
if (locs.size() != srcLocations.size()) {
throw new IOException("Rename of " + src + " to " + dst + " is not"
+ " allowed. The number of remote locations for both source and"
+ " target should be same.");
}
rpcClient.invokeConcurrent(locs, method);
} else {
rpcClient.invokeSequential(locs, method, null, null);
}
});
}
@Override
public void concat(String trg, String[] src) throws IOException {
rpcServer.checkOperation(NameNode.OperationCategory.WRITE);
// Concat only effects when all files in the same namespace.
getFileRemoteLocation(trg);
asyncApply((AsyncApplyFunction<RemoteLocation, Object>) targetDestination -> {
if (targetDestination == null) {View on GitHub (pinned to 2add963021)
Solutions
- Make the source and destination mount entries list identical destination sets (same namespaces, same order) with hdfs dfsrouteradmin -add and refresh
- Route the rename through a single-destination subtree (two-step rename)
- Verify both mount entries with hdfs dfsrouteradmin -ls before issuing batch renames
Defensive patterns
Strategy: try-catch
Try / catch
catch (IOException e) {
if (e.getMessage().contains("number of remote locations")) {
// rename2 blocked by asymmetric multi-dest mounts: align entries,
// or two-step rename via a single-destination subtree
}
} Prevention
- Apply mount table changes that add destinations to all related mounts in one maintenance step
- Validate multi-dest parity in CI against a router test fixture when tooling relies on FileSystem.rename
- Alert on rename failures mentioning 'remote locations' to catch mount drift early
When it happens
Trigger: rename2(src, dst, options) via an async Router where the source and destination mounts have different numbers of remote locations and dst is a multi-destination directory.
Common situations: Same as rename: asymmetric multi-destination mounts after mount-table edits; tools that use FileSystem.rename (which maps to rename2) against federated multi-dest trees.
Related errors
- Rename of {} to {} is not allowed. The number of remote loca
- The operation is not allowed because there are mount points:
- Cannot concatenate source file {sourceFile} because it is lo
- No mount point for %s
- The mount point has more than one destination. path={}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/03c7093c1d384ab0.
Report an issue: GitHub.