apache/hadoop · error · IOException

Block pool id required to get aliasmap reader

Error message

Block pool id required to get aliasmap reader

What it means

InMemoryLevelDBAliasMapClient.getAliasMap routes each request to the remote LevelDB alias map matching a block pool id. There is no default route: a null blockPoolID fails immediately with this IOException rather than ambiguously querying some cluster.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/blockaliasmap/impl/InMemoryLevelDBAliasMapClient.java:158

    @Override
    public void store(FileRegion fileRegion) throws IOException {
      aliasMap.write(fileRegion.getBlock(),
          fileRegion.getProvidedStorageLocation());
    }

    @Override
    public void close() throws IOException {
    }
  }

  InMemoryLevelDBAliasMapClient() {
    aliasMaps = new ArrayList<>();
  }

  private InMemoryAliasMapProtocol getAliasMap(String blockPoolID)
      throws IOException {
    if (blockPoolID == null) {
      throw new IOException("Block pool id required to get aliasmap reader");
    }
    // if a block pool id has been supplied, and doesn't match the associated
    // block pool ids, return null.
    for (InMemoryAliasMapProtocol aliasMap : aliasMaps) {
      try {
        String aliasMapBlockPoolId = aliasMap.getBlockPoolId();
        if (aliasMapBlockPoolId != null &&
            aliasMapBlockPoolId.equals(blockPoolID)) {
          return aliasMap;
        }
      } catch (IOException e) {
        LOG.error("Exception in retrieving block pool id {}", e);
      }
    }
    throw new IOException(
        "Unable to retrieve InMemoryAliasMap for block pool id " + blockPoolID);
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Pass the real block pool id, e.g. from datanodeRegistration.getBlockPoolID() or the BP directory name under the DN's data dir
  2. Fix the caller to thread the bpid parameter through instead of null
  3. Add a null-check assertion early in your wiring so the failure names your call site, not library internals

Example fix

// before
Reader<FileRegion> r = aliasMapClient.getReader(null, null);

// after
String bpid = datanodeRegistration.getBlockPoolID();
Reader<FileRegion> r = aliasMapClient.getReader(null, bpid);
Defensive patterns

Strategy: validation

Validate before calling

if (blockPoolID == null || blockPoolID.isEmpty()) {
  throw new IllegalArgumentException(
      "blockPoolID is required (get it from datanodeRegistration.getBlockPoolID())");
}
Reader<FileRegion> r = aliasMapClient.getReader(opts, blockPoolID);

Prevention

When it happens

Trigger: Calling getReader/getWriter on InMemoryLevelDBAliasMapClient with a null blockPoolID — typically custom integration code or tests that skip the argument, since the DatanodeFileSystem/provided-storage path always threads the bpid from the DN registration.

Common situations: Unit tests invoking the alias map client directly; glue code that wires a provided-storage DN but forgets to propagate blockPoolID from DatanodeRegistration.getBlockPoolID().

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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