prestodb/presto · critical · PrestoException

HIVE_MISSING_DATA

HIVE_MISSING_DATA

Error message

Error reading from %s at position %s. 

What it means

HdfsOrcDataSource.readInternal wraps any exception from the underlying HDFS read. If the exception's simple class name is BlockMissingException, it rethrows as PrestoException(HIVE_MISSING_DATA) — a datanode holding a block replica is unreachable or the block is genuinely missing, so the ORC reader cannot fetch bytes at the requested position.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/orc/HdfsOrcDataSource.java:74

        inputStream.close();
    }

    @Override
    protected void readInternal(long position, byte[] buffer, int bufferOffset, int bufferLength)
    {
        try {
            long readStart = System.nanoTime();
            inputStream.readFully(position, buffer, bufferOffset, bufferLength);
            stats.readDataBytesPerSecond(bufferLength, System.nanoTime() - readStart);
        }
        catch (PrestoException e) {
            // just in case there is a Presto wrapper or hook
            throw e;
        }
        catch (Exception e) {
            String message = format("Error reading from %s at position %s. ", this, position);
            if (e.getClass().getSimpleName().equals("BlockMissingException")) {
                throw new PrestoException(HIVE_MISSING_DATA, message, e);
            }
            if (e instanceof IOException) {
                throw new PrestoException(HIVE_FILESYSTEM_ERROR, message + e.getMessage(), e);
            }
            throw new PrestoException(HIVE_UNKNOWN_ERROR, message, e);
        }
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Run hdfs fsck <file-path> -blocks -locations to identify missing blocks and confirm the damage
  2. Restore the data: re-run the producing job, restore from snapshot/backup, or delete corrupt files and repair the partition
  3. Check datanode health and wait for re-replication (dfs.namenode.replication.work.multiplier-per-progressed-heartbeat) if blocks are merely under-replicated
  4. Retry the query after cluster recovery if the failure was transient (node restart)

Example fix

// before (operator check)
-- hdfs fsck /warehouse/t/part-0 -blocks -locations
-- status: HEALTHY -> corrupt blocks

// after
-- hadoop fs -rm /warehouse/t/part-0
-- re-run ETL to regenerate, then ALTER TABLE t ADD PARTITION ...
SELECT * FROM t;
Defensive patterns

Strategy: retry

Validate before calling

# preflight replication/health of the files to be read
hdfs fsck /warehouse/t -files -blocks -locations | grep -E 'MISSING|HEALTHY'

Try / catch

try {
    return query(sql);
} catch (PrestoException e) {
    if (e.getErrorCode().getName().equals("HIVE_MISSING_DATA")) {
        // transient node outage: retry with backoff; otherwise repair data
        return withRetry(sql, 3, exponentialBackoff());
    }
    throw e;
}

Prevention

When it happens

Trigger: ORC stripe/footer read at `position` throws an exception whose class name is exactly 'BlockMissingException' (HDFS block has no live replicas).

Common situations: Datanode failures or decommissioning during a query; corrupted/lost blocks after disk failure; under-replicated blocks following datanode crashes; files whose blocks were deleted by balancer/cleanup bugs.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/dd39b0b5ea5e91f7. Report an issue: GitHub.