{"record":{"id":"30d124e06dcaa0f4","repo":"apache/hadoop","slug":"enabling-or-disabling-storage-policy-satisfier-ser","errorCode":null,"errorMessage":"Enabling or disabling storage policy satisfier service on {state} NameNode is not allowed","messagePattern":"Enabling or disabling storage policy satisfier service on (.+?) NameNode is not allowed","errorType":"exception","errorClass":"ReconfigurationException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java","lineNumber":2588,"sourceCode":"      return result;\n    } catch (IllegalArgumentException e) {\n      throw new ReconfigurationException(property, newVal, getConf().get(property), e);\n    }\n  }\n\n  String reconfigureSPSModeEvent(String newVal, String property)\n      throws ReconfigurationException {\n    if (newVal == null\n        || StoragePolicySatisfierMode.fromString(newVal) == null) {\n      throw new ReconfigurationException(property, newVal,\n          getConf().get(property),\n          new HadoopIllegalArgumentException(\n              \"For enabling or disabling storage policy satisfier, must \"\n                  + \"pass either internal/external/none string value only\"));\n    }\n\n    if (!isActiveState()) {\n      throw new ReconfigurationException(property, newVal,\n          getConf().get(property),\n          new HadoopIllegalArgumentException(\n              \"Enabling or disabling storage policy satisfier service on \"\n                  + state + \" NameNode is not allowed\"));\n    }\n    StoragePolicySatisfierMode mode = StoragePolicySatisfierMode\n        .fromString(newVal);\n    if (mode == StoragePolicySatisfierMode.NONE) {\n      // disabling sps service\n      if (namesystem.getBlockManager().getSPSManager() != null) {\n        namesystem.getBlockManager().getSPSManager().changeModeEvent(mode);\n        namesystem.getBlockManager().disableSPS();\n      }\n    } else {\n      // enabling sps service\n      boolean spsCreated = (namesystem.getBlockManager()\n          .getSPSManager() != null);\n      if (!spsCreated) {","sourceCodeStart":2570,"sourceCodeEnd":2606,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L2570-L2606","documentation":"After validating the mode string, reconfigureSPSModeEvent requires the NameNode to be in active state: if !isActiveState() it throws ReconfigurationException wrapping HadoopIllegalArgumentException, embedding this node's current state variable (e.g. 'standby') in the message. The StoragePolicySatisfier service runs only on the active NameNode, so its mode cannot be changed on a standby or observer node.","triggerScenarios":"`hdfs dfsadmin -reconfig namenode <standbyAddr> -set dfs.storage.policy.satisfier.mode=...` - the reconfig RPC went to a standby/observer NameNode of an HA pair.","commonSituations":"The operator addressed the standby by habit or from stale documentation; a failover happened between scripting and execution so the previously-active address is now standby; automation hardcoded one node of the HA pair.","solutions":["Find the current active (`hdfs haadmin -getAllServiceState` or the NameNode web UI) and send the reconfig to that RPC address","Make automation resolve the active NN at runtime instead of hardcoding one node","If a failover is planned, reconfigure SPS mode on the new active after the failover completes","Verify with `hdfs haadmin -getServiceState <nnId>` right before the call"],"exampleFix":"# before - targeting a standby NameNode\nhdfs dfsadmin -reconfig namenode nn2:8020 -set dfs.storage.policy.satisfier.mode=external\n\n# after - resolve the active NN first, then reconfigure it\nACTIVE=$(hdfs haadmin -getAllServiceState | awk '/active/{print $1}' | head -1)\nhdfs dfsadmin -reconfig namenode \"${ACTIVE}\" -set dfs.storage.policy.satisfier.mode=external","handlingStrategy":"validation","validationCode":"# Resolve the ACTIVE NameNode before reconfiguring SPS mode\nACTIVE=$(hdfs haadmin -getAllServiceState | awk '/active/{print $1}' | head -1)\n[ -n \"$ACTIVE\" ] || { echo \"no active NN found\"; exit 1; }\nhdfs dfsadmin -reconfig namenode \"$ACTIVE\" -set dfs.storage.policy.satisfier.mode=external","typeGuard":"static boolean isActiveTarget(HAServiceProtocol p) throws IOException {\n  return p.getServiceState() == HAServiceState.ACTIVE;\n}","tryCatchPattern":"catch (ReconfigurationException e) {\n  if (e.getCause() != null && e.getCause().getMessage().contains(\"NameNode is not allowed\")) {\n    // re-resolve active NN and retry the reconfig there\n  }\n}","preventionTips":["Never hardcode one HA node's address in reconfig automation - resolve active at runtime","Re-check service state immediately before the call; failovers happen mid-script","After planned failovers, re-run SPS mode changes against the new active"],"tags":["hdfs","name-node","reconfig","storage-policy-satisfier","sps","ha","standby"],"backgroundTag":"operation-not-allowed-in-standby-state","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}