{"record":{"id":"4cefd45c782da8b7","repo":"prestodb/presto","slug":"invalid-orc-metadata-s-or-dwrf-stripe-cache-size","errorCode":null,"errorMessage":"Invalid ORC metadata %s or DWRF stripe cache size %s","messagePattern":"Invalid ORC metadata (.+?) or DWRF stripe cache size (.+?)","errorType":"exception","errorClass":"OrcCorruptionException","httpStatus":null,"severity":"error","filePath":"presto-orc/src/main/java/com/facebook/presto/orc/cache/StorageOrcFileTailSource.java","lineNumber":214,"sourceCode":"                        orcDataSource,\n                        Joiner.on('.').join(version),\n                        CURRENT_MAJOR_VERSION,\n                        CURRENT_MINOR_VERSION);\n            }\n        }\n    }\n\n    /**\n     * ORC metadata and DWRF stripe cache sizes are mutually exclusive because\n     * only ORC files have metadata, and only DWRF files have stripe cache.\n     * <p>\n     * Let's check that either both sizes are 0, or only one of them is\n     * greater than 0.\n     */\n    private static void checkSizes(OrcDataSource orcDataSource, int metadataSize, int dwrfStripeCacheSize)\n    {\n        if (metadataSize > 0 && dwrfStripeCacheSize > 0) {\n            throw new OrcCorruptionException(orcDataSource.getId(),\n                    \"Invalid ORC metadata %s or DWRF stripe cache size %s\",\n                    metadataSize,\n                    dwrfStripeCacheSize);\n        }\n\n        if (dwrfStripeCacheSize < 0) {\n            throw new OrcCorruptionException(orcDataSource.getId(), \"Invalid DWRF stripe cache length %s\", dwrfStripeCacheSize);\n        }\n    }\n}\n","sourceCodeStart":196,"sourceCodeEnd":225,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-orc/src/main/java/com/facebook/presto/orc/cache/StorageOrcFileTailSource.java#L196-L225","documentation":"DWRF files may carry an optional stripe footer cache. An ORC file's metadata section and the DWRF stripe cache are mutually exclusive tails: both being > 0 simultaneously is invalid. checkSizes throws OrcCorruptionException when both metadataSize and dwrfStripeCacheSize are positive.","triggerScenarios":"getOrcFileTail reads a DWRF postscript where both dwrfStripeCacheLength and metadataLength are greater than zero — an inconsistent combination from a corrupt or non-conforming file.","commonSituations":"Files produced by DWRF writers with mismatched/buggy postscript fields, or corruption flipping a length field from 0 to a positive value.","solutions":["Regenerate the file with a DWRF writer that emits a consistent postscript.","Validate with orc-tools/vertex-tools metadata dump to inspect both length fields.","Check for storage corruption and restore from a known-good copy.","Open an issue with the writer team if the file came from a specific internal pipeline version."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { tail = source.getOrcFileTail(ds, reader, validation, false, time); }\ncatch (OrcCorruptionException e) { reportWriterInconsistency(ds.getId(), e); }","preventionTips":["Use consistent, supported DWRF writer versions","Validate writer output (postscript fields) in CI for file-producing jobs","Restore from backup when corruption is detected"],"tags":["orc","dwrf","stripe-cache","corrupt-file"],"backgroundTag":"orc-file-corruption","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}