apache/hadoop · error · ReconfigurationException

Could not change property {} from '{}' to '{}'

Error message

Could not change property {} from '{}' to '{}'

What it means

reconfigureMinBlocksForWrite reconfigures dfs.namenode.blockplacementpolicy.min.blocks.for.write: adjustNewVal(DFS_NAMENODE_BLOCKPLACEMENTPOLICY_MIN_BLOCKS_FOR_WRITE_DEFAULT, newValue) falls back to the default for null or does Integer.parseInt, and BlockManager.setMinBlocksForWrite applies it. Any IllegalArgumentException (non-numeric input) is wrapped into ReconfigurationException(property, newValue, oldValue).

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java:2769

        newSetting = String.valueOf(datanodeManager.getDatanodeAdminManager().getBlocksPerLock());
      }
      LOG.info("RECONFIGURE* changed reconfigureDecommissionBackoffMonitorParameters {} to {}",
          property, newSetting);
      return newSetting;
    } catch (IllegalArgumentException e) {
      throw new ReconfigurationException(property, newVal, getConf().get(property), e);
    }
  }

  private String reconfigureMinBlocksForWrite(String property, String newValue)
      throws ReconfigurationException {
    try {
      int newSetting = adjustNewVal(
          DFS_NAMENODE_BLOCKPLACEMENTPOLICY_MIN_BLOCKS_FOR_WRITE_DEFAULT, newValue);
      namesystem.getBlockManager().setMinBlocksForWrite(newSetting);
      return String.valueOf(newSetting);
    } catch (IllegalArgumentException e) {
      throw new ReconfigurationException(property, newValue, getConf().get(property), e);
    }
  }

  private String reconfigureFSNamesystemLockMetricsParameters(final String property,
      final String newVal) throws ReconfigurationException {
    String result;
    try {
      switch (property) {
      case DFS_NAMENODE_LOCK_DETAILED_METRICS_KEY: {
        if (newVal != null && !newVal.equalsIgnoreCase("true") &&
            !newVal.equalsIgnoreCase("false")) {
          throw new IllegalArgumentException(newVal + " is not boolean value");
        }
        boolean enable = (newVal == null ?
            DFS_NAMENODE_LOCK_DETAILED_METRICS_DEFAULT : Boolean.parseBoolean(newVal));
        result = Boolean.toString(enable);
        namesystem.setMetricsEnabled(enable);
        break;

View on GitHub (pinned to 2add963021)

Solutions

  1. Send a plain integer: `-set dfs.namenode.blockplacementpolicy.min.blocks.for.write=1`
  2. Pre-check with a regex like ^[0-9]+$ in automation
  3. Restore the default by clearing the property in config rather than sending a string like 'default'
  4. Verify the applied value via `-reconfig namenode <addr> -status`

Example fix

# before
hdfs dfsadmin -reconfig namenode nn1:8020 -set dfs.namenode.blockplacementpolicy.min.blocks.for.write=2 blocks

# after
hdfs dfsadmin -reconfig namenode nn1:8020 -set dfs.namenode.blockplacementpolicy.min.blocks.for.write=2
Defensive patterns

Strategy: validation

Validate before calling

VAL=2
[[ "$VAL" =~ ^[0-9]+$ ]] || { echo "need plain integer"; exit 1; }
hdfs dfsadmin -reconfig namenode nn1:8020 -set dfs.namenode.blockplacementpolicy.min.blocks.for.write=$VAL

Type guard

static boolean isPlainInt(String s) {
  return s != null && s.matches("^[0-9]+$");
}

Try / catch

catch (ReconfigurationException e) {
  if (e.getCause() instanceof IllegalArgumentException) {
    // non-numeric min-blocks value - reject in the caller's form/UI before retry
  }
}

Prevention

When it happens

Trigger: `hdfs dfsadmin -reconfig namenode <addr> -set dfs.namenode.blockplacementpolicy.min.blocks.for.write=<non-integer>` - e.g. 'two', '2 blocks', '2.5'.

Common situations: Lowering min-blocks-for-write to allow writes on under-replicated clusters during node loss, with a malformed value; templated configs injecting blanks.

Related errors


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