{"record":{"id":"8fddf9e7d0c4f81d","repo":"apache/hadoop","slug":"file-version-has-no-block-pool-id","errorCode":null,"errorMessage":"file VERSION has no block pool Id.","messagePattern":"file VERSION has no block pool Id\\.","errorType":"exception","errorClass":"InconsistentFSStateException","httpStatus":null,"severity":"critical","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java","lineNumber":1054,"sourceCode":"    } catch (UnknownHostException e) {\n      LOG.warn(\"Could not find ip address of \\\"default\\\" inteface.\");\n      throw e;\n    }\n    \n    int rand = DFSUtil.getSecureRandom().nextInt(Integer.MAX_VALUE);\n    return \"BP-\" + rand + \"-\"+ ip + \"-\" + Time.now();\n  }\n\n  /** Validate and set block pool ID. */\n  public void setBlockPoolID(String bpid) {\n    blockpoolID = bpid;\n  }\n\n  /** Validate and set block pool ID. */\n  private void setBlockPoolID(File storage, String bpid)\n      throws InconsistentFSStateException {\n    if (bpid == null || bpid.equals(\"\")) {\n      throw new InconsistentFSStateException(storage, \"file \"\n          + Storage.STORAGE_FILE_VERSION + \" has no block pool Id.\");\n    }\n    \n    if (!blockpoolID.equals(\"\") && !blockpoolID.equals(bpid)) {\n      throw new InconsistentFSStateException(storage,\n          \"Unexepcted blockpoolID \" + bpid + \" . Expected \" + blockpoolID);\n    }\n    setBlockPoolID(bpid);\n  }\n  \n  public String getBlockPoolID() {\n    return blockpoolID;\n  }\n\n  /**\n   * Iterate over all current storage directories, inspecting them\n   * with the given inspector.\n   */","sourceCodeStart":1036,"sourceCodeEnd":1072,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L1036-L1072","documentation":"setBlockPoolID(File, bpid) validates the blockpoolID property read from a directory's VERSION under a federation-capable layout version: null or empty raises InconsistentFSStateException 'file VERSION has no block pool Id.' The block pool ID is namespace-wide under federation, so its absence means the directory predates federation or its VERSION was mangled.","triggerScenarios":"Reading a storage dir written by a pre-federation Hadoop release, or a VERSION whose blockpoolID line was removed or lost to a partial write (crash during writeProperties) or manual editing.","commonSituations":"Very old clusters moved to federation-capable releases without the documented upgrade procedure; hand-restored VERSION files missing lines; scripts that rewrite VERSION dropping keys they do not know.","solutions":["Restore or insert the cluster's real blockpoolID (format BP-<rand>-<ip>-<ts>) into the affected VERSION - it must equal the BP id in all other dirs of the same nameservice.","If every dir lacks it and this is a pre-federation upgrade, follow the federation upgrade path for that release instead of hand-patching.","Back up VERSION before editing; a wrong BP id produces the sibling 'Unexepcted blockpoolID' error next."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Assert every VERSION carries a blockpoolID before NN start\nfor (String loc : conf.getTrimmedStrings(\"dfs.namenode.name.dir\")) {\n  Map<String, String> props = parseVersion(Paths.get(stripScheme(loc), \"current\", \"VERSION\"));\n  String bpid = props.get(\"blockpoolID\");\n  if (bpid == null || bpid.trim().isEmpty()) {\n    throw new IllegalStateException(\"VERSION lacks blockpoolID (pre-federation or damaged): \" + loc);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the documented federation upgrade procedure for pre-federation storage; do not hand-patch.","Include VERSION in backups and verify key coverage (layoutVersion, clusterID, blockpoolID) after restores.","Never rewrite VERSION with tools that drop unknown keys."],"tags":["hdfs","namenode","storage","blockpool","version-file"],"backgroundTag":"missing-block-pool-id","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}