prestodb/presto · error · OrcCorruptionException

Invalid DWRF stripe cache length %s

Error message

Invalid DWRF stripe cache length %s

What it means

ORC tail-source sanity check: the DWRF stripe cache length read from the file's postscript is implausible (negative or exceeding the stripe size). A corruption sentinel for DWRF files — the postscript values for stripe cache are inconsistent with the file layout.

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/cache/StorageOrcFileTailSource.java:221

    /**
     * ORC metadata and DWRF stripe cache sizes are mutually exclusive because
     * only ORC files have metadata, and only DWRF files have stripe cache.
     * <p>
     * Let's check that either both sizes are 0, or only one of them is
     * greater than 0.
     */
    private static void checkSizes(OrcDataSource orcDataSource, int metadataSize, int dwrfStripeCacheSize)
    {
        if (metadataSize > 0 && dwrfStripeCacheSize > 0) {
            throw new OrcCorruptionException(orcDataSource.getId(),
                    "Invalid ORC metadata %s or DWRF stripe cache size %s",
                    metadataSize,
                    dwrfStripeCacheSize);
        }

        if (dwrfStripeCacheSize < 0) {
            throw new OrcCorruptionException(orcDataSource.getId(), "Invalid DWRF stripe cache length %s", dwrfStripeCacheSize);
        }
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Restore or regenerate the file; tail corruption is not fixable in place.
  2. Verify with a metadata dump tool what dwrfStripeCacheLength the postscript encodes.
  3. Check the writer version compatibility (DWRF feature flags) of the producing job.
  4. Enable end-to-end checksums on the storage layer to catch corruption early.
Defensive patterns

Strategy: try-catch

Try / catch

try { tail = source.getOrcFileTail(ds, reader, validation, false, time); }
catch (OrcCorruptionException e) { reportWriterInconsistency(ds.getId(), e); }

Prevention

When it happens

Trigger: getOrcFileTail parses a postscript where dwrfStripeCacheLength is negative (e.g. large unsigned value decoded as negative toIntExact result, or corrupt bytes).

Common situations: Corruption in the last bytes of the file, or a writer version emitting incompatible postscript fields.

Related errors


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