apache/hadoop · error · IOException
Incorrect block size
Error message
Incorrect block size
What it means
Error "Incorrect block size" thrown in apache/hadoop.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockRecoveryWorker.java:266
newBlock.setNumBytes(finalizedLength);
break;
case RBW:
case RWR:
long minLength = Long.MAX_VALUE;
for(BlockRecord r : syncList) {
ReplicaState rState = r.rInfo.getOriginalReplicaState();
if(rState == bestState) {
minLength = Math.min(minLength, r.rInfo.getNumBytes());
participatingList.add(r);
}
LOG.debug("syncBlock replicaInfo: block={}, from datanode {}, receivedState={}, " +
"receivedLength={}, bestState={}", block, r.id, rState.name(),
r.rInfo.getNumBytes(), bestState.name());
}
// recover() guarantees syncList will have at least one replica with RWR
// or better state.
if (minLength == Long.MAX_VALUE) {
throw new IOException("Incorrect block size");
}
newBlock.setNumBytes(minLength);
break;
case RUR:
case TEMPORARY:
assert false : "bad replica state: " + bestState;
default:
break; // we have 'case' all enum values
}
if (isTruncateRecovery) {
newBlock.setNumBytes(rBlock.getNewBlock().getNumBytes());
}
LOG.info("BlockRecoveryWorker: block={} (length={}), bestState={},"
+ " newBlock={} (length={}), participatingList={}",
block, block.getNumBytes(), bestState.name(), newBlock,
newBlock.getNumBytes(), participatingList);
View on GitHub (pinned to 2add963021)
Solutions
- Verify the client computed the new block length correctly during recovery/append; retry the operation.
- Check for version mismatch between client, NameNode, and DataNode causing disagreement on the block size.
When it happens
Trigger: During replica recovery synchronization, the target block size does not match the size agreed in the recovery protocol.
Common situations: A replica's on-disk size did not match the expected block size during recovery. Compare against other replicas and disk health before proceeding.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/e873e320bf4a7167.
Report an issue: GitHub.