{"record":{"id":"58286524835e878f","repo":"apache/hadoop","slug":"failed-to-s-since-s-is-set-to-false","errorCode":null,"errorMessage":"Failed to %s since %s is set to false.","messagePattern":"Failed to (.+?) since (.+?) is set to false\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java","lineNumber":2538,"sourceCode":"    if (success) {\n      getEditLog().logSync();\n      logAuditEvent(true, operationName, src);\n    }\n    return success;\n  }\n\n  /**\n   * Verify storage policies are enabled and if only super user is allowed to\n   * set storage policies.\n   *\n   * @param operationNameReadable Name of storage policy for exception text\n   * @param checkSuperUser Whether to check for super user privilege\n   * @throws IOException\n   */\n  private void checkStoragePolicyEnabled(final String operationNameReadable,\n      boolean checkSuperUser) throws IOException {\n    if (!isStoragePolicyEnabled) {\n      throw new IOException(String.format(\n          \"Failed to %s since %s is set to false.\", operationNameReadable,\n          DFS_STORAGE_POLICY_ENABLED_KEY));\n    }\n    if (checkSuperUser && isStoragePolicySuperuserOnly) {\n      checkSuperuserPrivilege(\n          CaseUtils.toCamelCase(operationNameReadable, false));\n    }\n  }\n\n  /**\n   * Set the storage policy for a file or a directory.\n   *\n   * @param src file/directory path\n   * @param policyName storage policy name\n   * @throws  IOException\n   */\n  void setStoragePolicy(String src, String policyName) throws IOException {\n    if (policyName.equalsIgnoreCase(","sourceCodeStart":2520,"sourceCodeEnd":2556,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L2520-L2556","documentation":"All storage-policy RPCs (setStoragePolicy, unsetStoragePolicy, satisfyStoragePolicy and related wrappers) funnel through checkStoragePolicyEnabled. When the NameNode runs with dfs.storage.policy.enabled=false, the call is refused with IOException('Failed to <operation> since dfs.storage.policy.enabled is set to false.') before permission or superuser checks run.","triggerScenarios":"`hdfs dfsadmin -setStoragePolicy -path <p> -policy <pol>` (or -unsetStoragePolicy / -satisfyStoragePolicy, or the equivalent ClientProtocol calls) against a NameNode whose hdfs-site.xml sets dfs.storage.policy.enabled=false.","commonSituations":"Cluster hardened per guidance to disable storage policies when heterogeneous storage is unused; tiering/Mover workflows enabled later without flipping the flag back; rolling upgrade leaves one NameNode with the old value so calls fail intermittently depending on which NN serves them.","solutions":["Set dfs.storage.policy.enabled=true in hdfs-site.xml on every NameNode (active and standbys) and restart/reapply the config","Verify with a read (hdfs fsck -storagepolicies or getStoragePolicy) that policies work before bulk -setStoragePolicy runs","If policies must stay disabled, tier data with explicit Mover workflows instead of storage policies"],"exampleFix":"<!-- hdfs-site.xml before -->\n<property><name>dfs.storage.policy.enabled</name><value>false</value></property>\n<!-- after: set on all NameNodes, then restart them -->\n<property><name>dfs.storage.policy.enabled</name><value>true</value></property>","handlingStrategy":"validation","validationCode":"if (!conf.getBoolean(\"dfs.storage.policy.enabled\", true)) {\n  throw new IllegalStateException(\"Storage policies disabled on this cluster (dfs.storage.policy.enabled=false)\");\n}","typeGuard":null,"tryCatchPattern":"catch (IOException e) { if (e.getMessage() != null && e.getMessage().contains(\"dfs.storage.policy.enabled\")) failWithConfigHint(); else throw e; }","preventionTips":["Keep client hdfs-site.xml aligned with the NameNode's storage-policy flag","Recheck the flag on all NameNodes after rolling upgrades before running policy bulk ops"],"tags":["hdfs","storage-policy","configuration","namenode"],"backgroundTag":"feature-disabled-by-config","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}