apache/hadoop · error · UnsupportedOperationException

Cannot setErasureCodingPolicy through a symlink to a non-Dis

Error message

Cannot setErasureCodingPolicy through a symlink to a non-DistributedFileSystem: {} -> {}

What it means

Error "Cannot setErasureCodingPolicy through a symlink to a non-DistributedFileSystem: {} -> {}" thrown in apache/hadoop.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java:3415

      final String ecPolicyName) throws IOException {
    statistics.incrementWriteOps(1);
    storageStatistics.incrementOpCounter(OpType.SET_EC_POLICY);
    Path absF = fixRelativePart(path);
    new FileSystemLinkResolver<Void>() {
      @Override
      public Void doCall(final Path p) throws IOException {
        dfs.setErasureCodingPolicy(getPathName(p), ecPolicyName);
        return null;
      }

      @Override
      public Void next(final FileSystem fs, final Path p) throws IOException {
        if (fs instanceof DistributedFileSystem) {
          DistributedFileSystem myDfs = (DistributedFileSystem) fs;
          myDfs.setErasureCodingPolicy(p, ecPolicyName);
          return null;
        }
        throw new UnsupportedOperationException(
            "Cannot setErasureCodingPolicy through a symlink to a "
                + "non-DistributedFileSystem: " + path + " -> " + p);
      }
    }.resolve(this, absF);
  }

  /**
   * Set the source path to satisfy storage policy.
   * @param path The source path referring to either a directory or a file.
   * @throws IOException
   */
  public void satisfyStoragePolicy(final Path path) throws IOException {
    statistics.incrementWriteOps(1);
    storageStatistics.incrementOpCounter(OpType.SATISFY_STORAGE_POLICY);
    Path absF = fixRelativePart(path);
    new FileSystemLinkResolver<Void>() {

      @Override

View on GitHub (pinned to 2add963021)

Solutions

  1. Set the erasure coding policy on the resolved HDFS path, not through a symlink to a non-DistributedFileSystem.
  2. Resolve the symlink target within HDFS first.

When it happens

Trigger: setErasureCodingPolicy is invoked through a symlink whose target is not a DistributedFileSystem, which does not support erasure coding policies.

Common situations: See trigger scenarios.


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