{"record":{"id":"c5b47dde6c77fc1a","repo":"apache/hadoop","slug":"setowner-operation-is-only-supported-on-hns-enable","errorCode":null,"errorMessage":"SetOwner operation is only supported on HNS enabled Accounts.","messagePattern":"SetOwner operation is only supported on HNS enabled Accounts\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java","lineNumber":1421,"sourceCode":"        tracingContext);\n  }\n\n  /**\n   * Set the owner of the file or directory.\n   * Not supported for HNS-Disabled Accounts.\n   * @param path on which owner has to be set.\n   * @param owner to be set.\n   * @param group to be set.\n   * @param tracingContext for tracing the server calls.\n   * @return exception as this operation is not supported on Blob Endpoint.\n   * @throws UnsupportedOperationException always.\n   */\n  @Override\n  public AbfsRestOperation setOwner(final String path,\n      final String owner,\n      final String group,\n      final TracingContext tracingContext) throws AzureBlobFileSystemException {\n    throw new UnsupportedOperationException(\n        \"SetOwner operation is only supported on HNS enabled Accounts.\");\n  }\n\n  /**\n   * Set the permission of the file or directory.\n   * Not supported for HNS-Disabled Accounts.\n   * @param path on which permission has to be set.\n   * @param permission to be set.\n   * @param tracingContext for tracing the server calls.\n   * @return exception as this operation is not supported on Blob Endpoint.\n   * @throws UnsupportedOperationException always.\n   */\n  @Override\n  public AbfsRestOperation setPermission(final String path,\n      final String permission,\n      final TracingContext tracingContext) throws AzureBlobFileSystemException {\n    throw new UnsupportedOperationException(\n        \"SetPermission operation is only supported on HNS enabled Accounts.\");","sourceCodeStart":1403,"sourceCodeEnd":1439,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsBlobClient.java#L1403-L1439","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Enable Hierarchical Namespace on the storage account (or target an HNS account for this workload)","Drop the owner/owner-and-groups flags from distcp (-p without p, i.e. skip ownership preservation)","Gate setOwner calls behind a namespace-enabled check in your own tooling"],"exampleFix":"// before: unconditional owner set -> UnsupportedOperationException on non-HNS\nfs.setOwner(path, \"user@domain\", \"group@domain\");\n\n// after: only apply ownership where the account supports it\nif (isHnsAccount(fs)) {\n  fs.setOwner(path, \"user@domain\", \"group@domain\");\n}","handlingStrategy":"validation","validationCode":"boolean isHns = ((AzureBlobFileSystem) fs)\n    .getAbfsStore().getIsNamespaceEnabled(tracingContext);\nif (isHns) {\n  fs.setOwner(path, owner, group);\n}","typeGuard":"private static boolean supportsPosixMetadata(FileSystem fs) {\n  return fs instanceof AzureBlobFileSystem\n      && fs.getConf().getBoolean(\"fs.azure.account.hns.enabled\", false);\n}","tryCatchPattern":"try {\n  fs.setOwner(path, owner, group);\n} catch (UnsupportedOperationException e) {\n  // account lacks hierarchical namespace: skip ownership, or fail loudly per policy\n}","preventionTips":["Enable HNS before adopting POSIX metadata tooling on ADLS Gen2","Omit ownership preservation from distcp when targeting non-HNS accounts","Gate setOwner behind a namespace-enabled capability check in shared code"],"tags":["azure","abfs","unsupported-operation","hns","acl","ownership"],"backgroundTag":"unsupported-operation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}