apache/hadoop · error · UnsupportedOperationException

SetOwner operation is only supported on HNS enabled Accounts

Error message

SetOwner operation is only supported on HNS enabled Accounts.

What it means

AbfsBlobClient — bound whenever the storage account lacks Hierarchical Namespace (HNS) — implements setOwner as an unconditional stub that throws UnsupportedOperationException('SetOwner operation is only supported on HNS enabled Accounts.'). Ownership/OID semantics only exist on ADLS Gen2 hierarchical namespace, so any setOwner call on a flat-namespace account fails immediately without a service round trip.

Source

Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java:1421

        tracingContext);
  }

  /**
   * Set the owner of the file or directory.
   * Not supported for HNS-Disabled Accounts.
   * @param path on which owner has to be set.
   * @param owner to be set.
   * @param group to be set.
   * @param tracingContext for tracing the server calls.
   * @return exception as this operation is not supported on Blob Endpoint.
   * @throws UnsupportedOperationException always.
   */
  @Override
  public AbfsRestOperation setOwner(final String path,
      final String owner,
      final String group,
      final TracingContext tracingContext) throws AzureBlobFileSystemException {
    throw new UnsupportedOperationException(
        "SetOwner operation is only supported on HNS enabled Accounts.");
  }

  /**
   * Set the permission of the file or directory.
   * Not supported for HNS-Disabled Accounts.
   * @param path on which permission has to be set.
   * @param permission to be set.
   * @param tracingContext for tracing the server calls.
   * @return exception as this operation is not supported on Blob Endpoint.
   * @throws UnsupportedOperationException always.
   */
  @Override
  public AbfsRestOperation setPermission(final String path,
      final String permission,
      final TracingContext tracingContext) throws AzureBlobFileSystemException {
    throw new UnsupportedOperationException(
        "SetPermission operation is only supported on HNS enabled Accounts.");

View on GitHub (pinned to 2add963021)

Solutions

  1. Enable Hierarchical Namespace on the storage account (or target an HNS account for this workload)
  2. Drop the owner/owner-and-groups flags from distcp (-p without p, i.e. skip ownership preservation)
  3. Gate setOwner calls behind a namespace-enabled check in your own tooling

Example fix

// before: unconditional owner set -> UnsupportedOperationException on non-HNS
fs.setOwner(path, "user@domain", "group@domain");

// after: only apply ownership where the account supports it
if (isHnsAccount(fs)) {
  fs.setOwner(path, "user@domain", "group@domain");
}
Defensive patterns

Strategy: validation

Validate before calling

boolean isHns = ((AzureBlobFileSystem) fs)
    .getAbfsStore().getIsNamespaceEnabled(tracingContext);
if (isHns) {
  fs.setOwner(path, owner, group);
}

Type guard

private static boolean supportsPosixMetadata(FileSystem fs) {
  return fs instanceof AzureBlobFileSystem
      && fs.getConf().getBoolean("fs.azure.account.hns.enabled", false);
}

Try / catch

try {
  fs.setOwner(path, owner, group);
} catch (UnsupportedOperationException e) {
  // account lacks hierarchical namespace: skip ownership, or fail loudly per policy
}

Prevention

When it happens

Trigger: Calling fs.setOwner(path, owner, group) on an abfs:// URL backed by a non-HNS storage account; typically distcp -p (preserve) or provisioning tooling that applies POSIX owner/group metadata.

Common situations: Distcp with -p from HDFS to a non-HNS ADLS account; automation assuming Gen2 semantics on a general-purpose v2 account; accounts created without HNS and later used with metadata-preserving tools.

Related errors


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