{"record":{"id":"0eb39b84045c93b3","repo":"apache/hadoop","slug":"unable-to-retrieve-inmemoryaliasmap-for-block-pool","errorCode":null,"errorMessage":"Unable to retrieve InMemoryAliasMap for block pool id \" + blockPoolID","messagePattern":"Unable to retrieve InMemoryAliasMap for block pool id \" \\+ blockPoolID","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/blockaliasmap/impl/InMemoryLevelDBAliasMapClient.java","lineNumber":173,"sourceCode":"  private InMemoryAliasMapProtocol getAliasMap(String blockPoolID)\n      throws IOException {\n    if (blockPoolID == null) {\n      throw new IOException(\"Block pool id required to get aliasmap reader\");\n    }\n    // if a block pool id has been supplied, and doesn't match the associated\n    // block pool ids, return null.\n    for (InMemoryAliasMapProtocol aliasMap : aliasMaps) {\n      try {\n        String aliasMapBlockPoolId = aliasMap.getBlockPoolId();\n        if (aliasMapBlockPoolId != null &&\n            aliasMapBlockPoolId.equals(blockPoolID)) {\n          return aliasMap;\n        }\n      } catch (IOException e) {\n        LOG.error(\"Exception in retrieving block pool id {}\", e);\n      }\n    }\n    throw new IOException(\n        \"Unable to retrieve InMemoryAliasMap for block pool id \" + blockPoolID);\n  }\n\n  @Override\n  public Reader<FileRegion> getReader(Reader.Options opts, String blockPoolID)\n      throws IOException {\n    InMemoryAliasMapProtocol aliasMap = getAliasMap(blockPoolID);\n    LOG.info(\"Loading InMemoryAliasMapReader for block pool id {}\",\n        blockPoolID);\n    return new LevelDbReader(aliasMap);\n  }\n\n  @Override\n  public Writer<FileRegion> getWriter(Writer.Options opts, String blockPoolID)\n      throws IOException {\n    InMemoryAliasMapProtocol aliasMap = getAliasMap(blockPoolID);\n    LOG.info(\"Loading InMemoryAliasMapWriter for block pool id {}\",\n        blockPoolID);","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/blockaliasmap/impl/InMemoryLevelDBAliasMapClient.java#L155-L191","documentation":"InMemoryLevelDBAliasMapClient iterates its configured InMemoryAliasMapProtocol handles (RPC endpoints from dfs.provided.aliasmap.inmemory.* config) and returns the one whose getBlockPoolId() equals the requested bpid. If no handle matches — including the case where every getBlockPoolId() RPC threw IOException and was only logged as ERROR — this IOException is thrown. Note the swallowing loop: an unreachable alias map server looks identical to a wrong block pool id.","triggerScenarios":"The blockPoolID belongs to none of the configured remote alias maps, or the alias map RPC endpoints are down/unreachable so their getBlockPoolId() calls fail (see companion ERROR log 'Exception in retrieving block pool id').","commonSituations":"dfs.provided.aliasmap.inmemory.rpc-address pointing at a dead or wrong service; federation setups where the DN reads with another nameservice's bpid; LevelDB alias map server (in the NN process) not started.","solutions":["Check the ERROR log line 'Exception in retrieving block pool id' — if present the root cause is the RPC failure there, not the bpid","Verify dfs.provided.aliasmap.inmemory.rpc-address/port point at the running NameNode-side LevelDB alias map service and network/kerberos allows the RPC","Confirm the bpid matches that cluster (compare with the BP-… directory name in the DN's provided/data dirs)","For federation, ensure an alias map endpoint is configured for each nameservice whose blocks the DN serves"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Preflight: at least one configured alias map must answer for this bpid\nboolean found = false;\nfor (InMemoryAliasMapProtocol p : aliasMapEndpoints) {\n  try {\n    if (blockPoolID.equals(p.getBlockPoolId())) { found = true; break; }\n  } catch (IOException ignored) {\n    // endpoint down — surface it instead of silently skipping\n  }\n}\nif (!found) throw new IllegalStateException(\n    \"No alias map serves block pool \" + blockPoolID);","typeGuard":null,"tryCatchPattern":"try {\n  Reader<FileRegion> r = aliasMapClient.getReader(opts, blockPoolID);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Unable to retrieve InMemoryAliasMap\")) {\n    // check the companion ERROR log for RPC failures vs wrong bpid before retrying\n  }\n  throw e;\n}","preventionTips":["Health-check alias map RPC endpoints as part of cluster validation","In federated setups, keep a mapping of nameservice -> alias map address in config checks"],"tags":["provided-storage","aliasmap","inmemory-leveldb","block-pool","rpc"],"backgroundTag":"resource-not-found","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}