apache/hadoop · error · IOException

InMemoryAliasMap enabled with null location

Error message

InMemoryAliasMap enabled with null location

What it means

BootstrapStandby.parseProvidedConfigurations() enables aliasmap bootstrapping when both dfs.namenode.provided.enabled and dfs.provided.aliasmap.inmemory.enabled are true, then reads the location from dfs.provided.aliasmap.inmemory.leveldb.dir. formatAndDownloadAliasMap() throws IOException when that key is unset, because there is nowhere to download the InMemoryAliasMap to.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/BootstrapStandby.java:548

    @Override
    public String toString() {
      return "AliasMap directory = " + this.getRoot();
    }
  }

  /**
   * Format, if needed, and download the aliasmap.
   * @param pathAliasMap the path where the aliasmap should be downloaded.
   * @param proxyInfo remote namenode to get the aliasmap from.
   * @return 0 on a successful transfer, and error code otherwise.
   * @throws IOException
   */
  private int formatAndDownloadAliasMap(String pathAliasMap,
      RemoteNameNodeInfo proxyInfo) throws IOException {
    LOG.info("Bootstrapping the InMemoryAliasMap from "
        + proxyInfo.getHttpAddress());
    if (pathAliasMap == null) {
      throw new IOException("InMemoryAliasMap enabled with null location");
    }
    File aliasMapFile = new File(pathAliasMap);
    if (aliasMapFile.exists()) {
      AliasMapStorageDirectory aliasMapSD =
          new AliasMapStorageDirectory(aliasMapFile);
      if (!Storage.confirmFormat(
          Arrays.asList(aliasMapSD), force, interactive)) {
        return ERR_CODE_ALREADY_FORMATTED;
      } else {
        if (!FileUtil.fullyDelete(aliasMapFile)) {
          throw new IOException(
              "Cannot remove current alias map: " + aliasMapFile);
        }
      }
    }

    // create the aliasmap location.
    if (!aliasMapFile.mkdirs()) {

View on GitHub (pinned to 2add963021)

Solutions

  1. Set dfs.provided.aliasmap.inmemory.leveldb.dir to a local writable path on the standby, matching the active's layout
  2. Or, if the standby should not hold an in-memory aliasmap, disable dfs.provided.aliasmap.inmemory.enabled there
  3. Re-run 'hdfs namenode -bootstrapStandby' after the configuration fix

Example fix

<!-- before: aliasmap enabled, no location -->
<property><name>dfs.namenode.provided.enabled</name><value>true</value></property>
<property><name>dfs.provided.aliasmap.inmemory.enabled</name><value>true</value></property>
<!-- after: add the leveldb dir -->
<property><name>dfs.provided.aliasmap.inmemory.leveldb.dir</name><value>/data/dfs/aliasmap/inmemory</value></property>
Defensive patterns

Strategy: validation

Validate before calling

boolean provided = conf.getBoolean("dfs.namenode.provided.enabled", false);
boolean aliasmap = conf.getBoolean("dfs.provided.aliasmap.inmemory.enabled", false);
String dir = conf.get("dfs.provided.aliasmap.inmemory.leveldb.dir");
if (provided && aliasmap && dir == null) {
  throw new IOException("InMemoryAliasMap enabled but "
      + "dfs.provided.aliasmap.inmemory.leveldb.dir is unset");
}

Try / catch

try {
  runner.run(argv); // BootstrapStandby with provided storage
} catch (IOException e) { // "InMemoryAliasMap enabled with null location"
  // config gap: set the leveldb dir (or disable the aliasmap) and re-run
}

Prevention

When it happens

Trigger: 'hdfs namenode -bootstrapStandby' with provided storage + in-memory aliasmap enabled but dfs.provided.aliasmap.inmemory.leveldb.dir absent from configuration, so aliasMapPath is null at the download step.

Common situations: Provided-storage (HDFS-14952 era) rollout where the active node got the leveldb dir setting but the standby template did not; key renamed/misspelled across releases; aliasmap enabled globally but the standby was expected to use a remote aliasmap.

Related errors


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