apache/hadoop · error · IOException

Rename of {} to {} is not allowed, no eligible destination i

Error message

Rename of {} to {} is not allowed, no eligible destination in the same namespace was found

What it means

Router federation rename (RouterFederationRename.routerFedRename) rejects a rename whose source and destination fall in different namespaces when cross-namespace rename is disabled. isEnableRenameAcrossNamespace() is true only when dfs.federation.router.federation.rename.option is not NONE (the default is NONE), so by default the router refuses any rename that cannot be answered by a single nameservice. The message means: no eligible destination in the same namespace was found and fed-rename support is off.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterFederationRename.java:100

    this.rpcServer = rpcServer;
    this.conf = conf;
  }

  /**
   * Router federation rename across namespaces.
   *
   * @param src the source path. There is no mount point under the src path.
   * @param dst the dst path.
   * @param srcLocations the remote locations of src.
   * @param dstLocations the remote locations of dst.
   * @throws IOException if rename fails.
   * @return true if rename succeeds.
   */
  public boolean routerFedRename(final String src, final String dst,
      final List<RemoteLocation> srcLocations,
      final List<RemoteLocation> dstLocations) throws IOException {
    if (!rpcServer.isEnableRenameAcrossNamespace()) {
      throw new IOException("Rename of " + src + " to " + dst
          + " is not allowed, no eligible destination in the same namespace was"
          + " found");
    }
    if (srcLocations.size() != 1 || dstLocations.size() != 1) {
      throw new IOException("Rename of " + src + " to " + dst + " is not"
          + " allowed. The remote location should be exactly one.");
    }
    RemoteLocation srcLoc = srcLocations.get(0);
    RemoteLocation dstLoc = dstLocations.get(0);
    checkSnapshotPath(srcLoc, dstLoc);
    checkPermission(srcLoc, dstLoc);

    UserGroupInformation routerUser = UserGroupInformation.getLoginUser();

    try {
      // as router user with saveJournal and task submission privileges
      return routerUser.doAs((PrivilegedExceptionAction<Boolean>) () -> {
        // Build and submit router federation rename job.

View on GitHub (pinned to 2add963021)

Solutions

  1. Restructure the mount table so src and dst resolve into the same namespace (single mount entry covering both), then retry the rename
  2. Enable router federation rename: set dfs.federation.router.federation.rename.option=DISTCP plus the required dfs.federation.router.federation.rename.map / .bandwidth settings, and restart the router
  3. If fed rename is not acceptable, copy data with distcp (or a two-step copy+delete) instead of rename

Example fix

# before
hdfs dfs -fs hdfs://router:8888 -mv /ns0mount/data /ns1mount/data   # fails: different namespaces
# after (hdfs-site.xml on router, then restart)
<property><name>dfs.federation.router.federation.rename.option</name><value>DISTCP</value></property>
<property><name>dfs.federation.router.federation.rename.map</name><value>10</value></property>
<property><name>dfs.federation.router.federation.rename.bandwidth</name><value>100</value></property>
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check both sides resolve to the same namespace before attempting rename
List<RemoteLocation> s = resolver.getLocationsForPath(src, false);
List<RemoteLocation> d = resolver.getLocationsForPath(dst, false);
if (!s.get(0).getNameserviceId().equals(d.get(0).getNameserviceId())
    && !fedRenameEnabled(conf)) {
  throw new UnsupportedOperationException(
      "Cross-namespace rename requires dfs.federation.router.federation.rename.option=DISTCP");
}

Type guard

boolean fedRenameEnabled(Configuration conf) {
  return !"NONE".equals(conf.get("dfs.federation.router.federation.rename.option", "NONE")
      .toUpperCase(Locale.ROOT));
}

Try / catch

try {
  fs.rename(srcPath, dstPath);
} catch (IOException e) {
  if (e.getMessage() != null && e.getMessage().contains("no eligible destination in the same namespace")) {
    // either restructure mounts so both paths share a namespace, or route via distcp
  }
  throw e;
}

Prevention

When it happens

Trigger: ClientProtocol#rename(src, dst) through the router where the mount table resolves src and dst to different nameservices (or to different RemoteLocation namespaces), while dfs.federation.router.federation.rename.option=NONE (default). The router's location-for-path lookup finds no single namespace containing both, falls into routerFedRename, and the option check throws.

Common situations: Default router configuration after enabling HDFS federation; mount table split so a data directory and its target directory live in different subclusters; teams expecting plain rename to work across mounts without enabling the distcp-based fed rename.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/b766280d62c1bf49. Report an issue: GitHub.