{"record":{"id":"790b0eb321cabe17","repo":"apache/hadoop","slug":"block-pool-ids-mismatched-block-i-blocki-ex","errorCode":null,"errorMessage":"Block pool IDs mismatched: block${i}=${blocki}, expected block group=${blockGroup}","messagePattern":"Block pool IDs mismatched: block(.+?)=(.+?), expected block group=(.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/StripedBlockUtil.java","lineNumber":1010,"sourceCode":"    public long getLength() {\n      return length;\n    }\n\n    @Override\n    public String toString() {\n      return String.format(\"StripeRange(offsetInBlock=%d, length=%d)\",\n          offsetInBlock, length);\n    }\n  }\n\n  /**\n   * Check if the information such as IDs and generation stamps in block-i\n   * match the block group.\n   */\n  public static void checkBlocks(ExtendedBlock blockGroup,\n      int i, ExtendedBlock blocki) throws IOException {\n    if (!blocki.getBlockPoolId().equals(blockGroup.getBlockPoolId())) {\n      throw new IOException(\"Block pool IDs mismatched: block\" + i + \"=\"\n          + blocki + \", expected block group=\" + blockGroup);\n    }\n    if (blocki.getBlockId() - i != blockGroup.getBlockId()) {\n      throw new IOException(\"Block IDs mismatched: block\" + i + \"=\"\n          + blocki + \", expected block group=\" + blockGroup);\n    }\n    if (blocki.getGenerationStamp() != blockGroup.getGenerationStamp()) {\n      throw new IOException(\"Generation stamps mismatched: block\" + i + \"=\"\n          + blocki + \", expected block group=\" + blockGroup);\n    }\n  }\n\n  public static int getBlockIndex(Block reportedBlock) {\n    long BLOCK_GROUP_INDEX_MASK = 15;\n    return (int) (reportedBlock.getBlockId() &\n        BLOCK_GROUP_INDEX_MASK);\n  }\n}","sourceCodeStart":992,"sourceCodeEnd":1028,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/util/StripedBlockUtil.java#L992-L1028","documentation":"StripedBlockUtil.checkBlocks() validates that an internal block i of a striped block group matches the group. This first check requires the block pool ID of block i to equal the group's block pool ID; a mismatch throws IOException. It is called from DFSStripedOutputStream.waitEndBlocks() while writing an erasure-coded file, when each streamer reports its allocated block before a new block group starts — so the error fails the EC file write.","triggerScenarios":"Writing an EC (striped) file when an internal block handed back by a datanode belongs to a different block pool than the block group — effectively cross-namespace block assignment; in practice only from internal inconsistency or a defect, not from client configuration.","commonSituations":"Cluster upgrades where NN/DN disagree on block group layout, federated namespaces misrouting allocations, or Hadoop bug reports around striped block allocation. Users see it as a failed write of an erasure-coded file.","solutions":["Retry the write job — transient allocation races during DN restart/decommission usually clear","Verify all NameNodes and DataNodes run the same (compatible) Hadoop version; EC block-group layout changed across releases","Inspect the block pool IDs in the message: if they name different namespaces, check federation/nameservice routing for the client","If reproducible, collect NN and DN logs for the block ids in the message and open a Hadoop JIRA"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  try (FSDataOutputStream out = fs.create(ecPath)) { /* write striped data */ }\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Block pool IDs mismatched\")) {\n    // internal allocation inconsistency: retry the job once, then investigate cluster health\n    LOG.warn(\"Striped write failed on block pool mismatch, retrying\", e);\n  } else { throw e; }\n}","preventionTips":["Keep NN/DN versions uniform across the cluster during EC writes","Avoid starting EC writes during rolling upgrades or mass DN restarts","Retain the block pool IDs from the message for cluster forensics"],"tags":["hdfs","erasure-coding","striped-blocks","block-pool","write-path"],"backgroundTag":"block-metadata-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}