{"record":{"id":"bc0626230808a87e","repo":"apache/hadoop","slug":"unexpected-blockpoolid-expected","errorCode":null,"errorMessage":"Unexpected blockpoolID {}. Expected {}","messagePattern":"Unexpected blockpoolID (.+?)\\. Expected (.+?)","errorType":"exception","errorClass":"InconsistentFSStateException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceStorage.java","lineNumber":334,"sourceCode":"  @Override\n  protected void setPropertiesFromFields(Properties props, StorageDirectory sd)\n      throws IOException {\n    props.setProperty(\"layoutVersion\", String.valueOf(layoutVersion));\n    props.setProperty(\"namespaceID\", String.valueOf(namespaceID));\n    props.setProperty(\"blockpoolID\", blockpoolID);\n    props.setProperty(\"cTime\", String.valueOf(cTime));\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_FILE_VERSION + \" is invalid.\");\n    }\n    \n    if (!blockpoolID.equals(\"\") && !blockpoolID.equals(bpid)) {\n      throw new InconsistentFSStateException(storage,\n          \"Unexpected blockpoolID \" + bpid + \". Expected \" + blockpoolID);\n    }\n    blockpoolID = bpid;\n  }\n  \n  @Override\n  protected void setFieldsFromProperties(Properties props, StorageDirectory sd)\n      throws IOException {\n    setLayoutVersion(props, sd);\n    setNamespaceID(props, sd);\n    setcTime(props, sd);\n    \n    String sbpid = props.getProperty(\"blockpoolID\");\n    setBlockPoolID(sd.getRoot(), sbpid);\n  }\n\n  /**\n   * Analyze whether a transition of the BP state is required and","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceStorage.java#L316-L352","documentation":"The blockpoolID in the VERSION file disagrees with the block pool already loaded/expected: the storage directory contents belong to a different block pool than the one being loaded. Thrown as InconsistentFSStateException with expected vs actual IDs.","triggerScenarios":"A BP directory copied or renamed from another cluster or another block pool; VERSION edited to the wrong bpid; storage from two clusters mixed on one DN.","commonSituations":"Migrating disks between test clusters by file copy; restoring BP dirs into the wrong cluster; NN re-formatted generating a new bpid while old dirs linger.","solutions":["Move the directory back under a path named for its real bpid (or fix the VERSION blockpoolID to match the directory's pool)","If the blocks belong to an old cluster you no longer run, delete the BP dir","Never clone block pool directories between clusters — re-replicate instead"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"String dirBpid = bpDir.getName();\nString fileBpid = props.getProperty(\"blockpoolID\");\nif (!dirBpid.equals(fileBpid)) {\n  throw new IOException(\"BP dir \" + dirBpid + \" contains storage for \" + fileBpid);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never copy block pool directories between clusters or bpool ids","When reusing disks, format DN storage fresh and let replication rebuild data"],"tags":["hdfs","datanode","storage","blockpoolid","identity-mismatch"],"backgroundTag":"cluster-identity-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}