apache/hadoop · error · IllegalStateException

Error instantiating ReservedSpaceCalculator

Error message

Error instantiating ReservedSpaceCalculator

What it means

Error "Error instantiating ReservedSpaceCalculator" thrown in apache/hadoop.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/ReservedSpaceCalculator.java:84

    public Builder setDir(String newDir) {
      this.dir = newDir;
      return this;
    }

    ReservedSpaceCalculator build() {
      try {
        Class<? extends ReservedSpaceCalculator> clazz = conf.getClass(
            DFS_DATANODE_DU_RESERVED_CALCULATOR_KEY,
            DFS_DATANODE_DU_RESERVED_CALCULATOR_DEFAULT,
            ReservedSpaceCalculator.class);

        Constructor constructor = clazz.getConstructor(
            Configuration.class, DF.class, StorageType.class, String.class);

        return (ReservedSpaceCalculator) constructor.newInstance(
            conf, usage, storageType, dir);
      } catch (Exception e) {
        throw new IllegalStateException(
            "Error instantiating ReservedSpaceCalculator", e);
      }
    }
  }

  private final DF usage;
  private final Configuration conf;
  private final StorageType storageType;

  private final String dir;

  ReservedSpaceCalculator(Configuration conf, DF usage,
      StorageType storageType, String dir) {
    this.usage = usage;
    this.conf = conf;
    this.storageType = storageType;
    this.dir = dir;
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Check the configured ReservedSpaceCalculator class name (dfs.datanode.reserved.space.calculator) for typos and ensure the class is on the DataNode classpath.
  2. Review the DataNode log for the reflection/constructor error and fix the custom calculator implementation.

When it happens

Trigger: DataNode startup when the configured dfs.datanode.du.reserved calculator class cannot be instantiated (missing class, bad constructor, config error).

Common situations: See trigger scenarios.


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