apache/hadoop · error · IOException

No data exists for block {}

Error message

No data exists for block {}

What it means

Thrown as IOException from FsDatasetImpl.getBlockInputStream(ExtendedBlock, seekOffset) when the volumeMap lookup under the DIR read lock returns no replica for the block. Distinct from the pmem-cache path above it: the lock is taken, volumeMap.get is done, RAM_DISK touches are accounted for, and only then is a null info fatal. It means this DataNode holds no replica for the given ExtendedBlock at lookup time.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java:852

  @Override // FsDatasetSpi
  public InputStream getBlockInputStream(ExtendedBlock b,
      long seekOffset) throws IOException {

    ReplicaInfo info;
    try (AutoCloseableLock lock = lockManager.readLock(LockLevel.DIR,
        b.getBlockPoolId(), getStorageUuidForLock(b),
        datasetSubLockStrategy.blockIdToSubLock(b.getBlockId()))) {
      info = volumeMap.get(b.getBlockPoolId(), b.getLocalBlock());
    }

    if (info != null && info.getVolume().isTransientStorage()) {
      ramDiskReplicaTracker.touch(b.getBlockPoolId(), b.getBlockId());
      datanode.getMetrics().incrRamDiskBlocksReadHits();
    }

    if (info == null) {
      throw new IOException("No data exists for block " + b);
    }
    return getBlockInputStreamWithCheckingPmemCache(info, b, seekOffset);
  }

  /**
   * Check whether the replica is cached to persistent memory.
   * If so, get DataInputStream of the corresponding cache file on pmem.
   */
  private InputStream getBlockInputStreamWithCheckingPmemCache(
      ReplicaInfo info, ExtendedBlock b, long seekOffset) throws IOException {
    String cachePath = cacheManager.getReplicaCachePath(
        b.getBlockPoolId(), b.getBlockId());
    if (cachePath != null) {
      long addr = cacheManager.getCacheAddress(
          b.getBlockPoolId(), b.getBlockId());
      if (addr != -1) {
        LOG.debug("Get InputStream by cache address.");
        return FsDatasetUtil.getDirectInputStream(

View on GitHub (pinned to 2add963021)

Solutions

  1. Re-fetch block locations from the NameNode and read from a different replica (getBlockLocations → pick another DN).
  2. On the DataNode, run hdfs dfsadmin -fs <dn-host> ... or check the DN's block pool state; trigger a full block report (hdfs dfsadmin -triggerBlockReport -ip <dn>) so stale mappings converge.
  3. Verify the ExtendedBlock's blockPoolId matches a block pool this DataNode serves.
  4. If persistent, hdfs fsck the file to confirm replication health and let re-replication restore missing replicas.
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check volumeMap-backed existence before opening an input stream.
if (fsDataset.getReplica(b.getBlockPoolId(), b.getBlockId()) == null) {
  // pick another replica from refreshed locations
  LocatedBlock lb = dfsClient.getLocatedBlocks(
      b.getBlockPoolId() + "/path", 0, 1).get(0);
  return openFrom(lb);
}

Try / catch

// Generic IOException here means 'this DN has no replica' per the source;
// fall back to another replica rather than failing the read.
try {
  return fsDataset.getBlockInputStream(b, seekOffset);
} catch (IOException e) {
  if (String.valueOf(e.getMessage()).startsWith("No data exists for block")) {
    return readFromNextBestReplica(dfsClient, b, seekOffset);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling FsDatasetSpi.getBlockInputStream (client read with offset, e.g. transferBlock/serveBlock) for a block whose (bpid, block) is absent from volumeMap — deleted replica, unreported deletion, wrong DN in the pipeline, or a block pool not yet (or no longer) initialized on this DN.

Common situations: NameNode directed a reader to a DataNode whose replica was just deleted (balancer/mover or admin invalidation); DN restarted with missing volumes so its map is empty for those blocks; client uses a stale locatedBlocks after failover; block scanner iterating a stale block list.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/98ebe8aded3372c2. Report an issue: GitHub.