{"record":{"id":"132fd53820ff01da","repo":"apache/cassandra","slug":"error-seeking-to-rowids-offset-for-ordinal-d-with","errorCode":null,"errorMessage":"Error seeking to rowIds offset for ordinal %d with ordToRowOffset %d","messagePattern":"Error seeking to rowIds offset for ordinal (.+?) with ordToRowOffset (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/index/sai/disk/v1/vector/OnDiskOrdinalsMap.java","lineNumber":105,"sourceCode":"            // read index entry\n            try\n            {\n                reader.seek(ordToRowOffset + 4L + vectorOrdinal * 8L);\n            }\n            catch (Exception e)\n            {\n                throw new RuntimeException(String.format(\"Error seeking to index offset for ordinal %d with ordToRowOffset %d\",\n                                                         vectorOrdinal, ordToRowOffset), e);\n            }\n            long offset = reader.readLong();\n            // seek to and read rowIds\n            try\n            {\n                reader.seek(offset);\n            }\n            catch (Exception e)\n            {\n                throw new RuntimeException(String.format(\"Error seeking to rowIds offset for ordinal %d with ordToRowOffset %d\",\n                                                         vectorOrdinal, ordToRowOffset), e);\n            }\n            int postingsSize = reader.readInt();\n            int[] rowIds = new int[postingsSize];\n            for (int i = 0; i < rowIds.length; i++)\n            {\n                rowIds[i] = reader.readInt();\n            }\n            return rowIds;\n        }\n\n        @Override\n        public void close()\n        {\n            reader.close();\n        }\n    }\n","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/sai/disk/v1/vector/OnDiskOrdinalsMap.java#L87-L123","documentation":"RuntimeException thrown when the seek to the per-ordinal rowIds (postings) offset fails in getSegmentRowIdsMatching. After reading the offset for a vector ordinal, the reader seeks to it to read the postings list; failure means the offset is invalid or the file region is unreadable/corrupt.","triggerScenarios":"Querying a vector ordinal whose postings offset points outside the file, truncated postings area, corrupted ordinal map contents, or mismatched segment files.","commonSituations":"Disk corruption, incomplete flush of vector index segments, mixing files across segment generations, or storage read errors under the mmap layer.","solutions":["REBUILD the vector index (or scrub the SSTable) to regenerate valid postings offsets","Restore a consistent set of index component files from a good backup","Inspect the chained cause for the underlying IO/mmap error and check the storage medium","Verify the reader/writer SAI format versions match across the cluster"],"exampleFix":"// before\nlong offset = reader.readLong();\nreader.seek(offset); // may throw wrapped RuntimeException\n// after\nlong offset = reader.readLong();\nif (offset < 0 || offset >= segmentEnd)\n    throw new CorruptIndexException(\"invalid postings offset \" + offset, ...);\nreader.seek(offset);","handlingStrategy":"try-catch","validationCode":"long offset = readPostingsOffset(ordinal);\nif (offset < 0 || offset >= segmentEnd)\n    throw new CorruptIndexException(\"postings offset out of bounds: \" + offset, \"vector\");","typeGuard":"boolean postingsOffsetValid(long offset, long segmentEnd) {\n    return offset >= 0 && offset < segmentEnd;\n}","tryCatchPattern":"try {\n    reader.seek(offset);\n} catch (RuntimeException e) {\n    logger.error(\"Postings seek failed for ordinal {}: {}\", ordinal, e.getMessage(), e);\n    markSegmentCorrupt(segmentOffset);\n}","preventionTips":["Validate offsets read from the ordinal map before seeking","Restore complete index file sets from consistent backups","Monitor storage health; repeated IO failures indicate disk issues"],"tags":["cassandra","sai","vector-index","io"],"backgroundTag":"file-read-failed","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}