{"record":{"id":"5ff1021fdd0dd47f","repo":"apache/cassandra","slug":"query-s-attempted-to-access-a-large-rowindexentry","errorCode":null,"errorMessage":"Query %s attempted to access a large RowIndexEntry estimated to be %d bytes in-memory (total entries: %d, total bytes: %d) but the max allowed is %s; query aborted  (see row_index_read_size_fail_threshold)","messagePattern":"Query (.+?) attempted to access a large RowIndexEntry estimated to be (.+?) bytes in-memory \\(total entries: (.+?), total bytes: (.+?)\\) but the max allowed is (.+?); query aborted  \\(see row_index_read_size_fail_threshold\\)","errorType":"exception","errorClass":"RowIndexEntryReadSizeTooLargeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/io/sstable/format/big/RowIndexEntry.java","lineNumber":408,"sourceCode":"            DataStorageSpec.LongBytesBound warnThreshold = DatabaseDescriptor.getRowIndexReadSizeWarnThreshold();\n            DataStorageSpec.LongBytesBound failThreshold = DatabaseDescriptor.getRowIndexReadSizeFailThreshold();\n            if (warnThreshold == null && failThreshold == null)\n                return;\n\n            long estimatedMemory = estimateMaterializedIndexSize(entries, bytes);\n            if (tableMetrics != null)\n                tableMetrics.rowIndexSize.update(estimatedMemory);\n\n            if (failThreshold != null && estimatedMemory > failThreshold.toBytes())\n            {\n                String msg = String.format(\"Query %s attempted to access a large RowIndexEntry estimated to be %d bytes \" +\n                                           \"in-memory (total entries: %d, total bytes: %d) but the max allowed is %s;\" +\n                                           \" query aborted  (see row_index_read_size_fail_threshold)\",\n                                           command.toCQLString(), estimatedMemory, entries, bytes, failThreshold);\n                MessageParams.remove(ParamType.ROW_INDEX_READ_SIZE_WARN);\n                MessageParams.add(ParamType.ROW_INDEX_READ_SIZE_FAIL, estimatedMemory);\n\n                throw new RowIndexEntryReadSizeTooLargeException(msg);\n            }\n            else if (warnThreshold != null && estimatedMemory > warnThreshold.toBytes())\n            {\n                // use addIfLarger rather than add as a previous partition may be larger than this one\n                Long current = MessageParams.get(ParamType.ROW_INDEX_READ_SIZE_WARN);\n                if (current == null || current.compareTo(estimatedMemory) < 0)\n                    MessageParams.add(ParamType.ROW_INDEX_READ_SIZE_WARN, estimatedMemory);\n            }\n        }\n\n        private static long estimateMaterializedIndexSize(int entries, int bytes)\n        {\n            long overhead = IndexInfo.EMPTY_SIZE\n                            + ArrayClustering.EMPTY_SIZE\n                            + DeletionTime.EMPTY_SIZE;\n\n            return (overhead * entries) + bytes;\n        }","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/io/sstable/format/big/RowIndexEntry.java#L390-L426","documentation":"Thrown as RowIndexEntryReadSizeTooLargeException when deserializing a RowIndexEntry for a query would exceed the row_index_read_size_fail_threshold for estimated in-memory size. This guards the coordinator against huge row indexes (very wide partitions) that could exhaust heap.","triggerScenarios":"A query touches a partition whose serialized row index (many indexInfo blocks / entries) estimates above the fail threshold bytes when deserialized; checkSize is invoked from RowIndexEntry.deserialize with the read command.","commonSituations":"Extremely wide partitions (millions of rows per partition); too-low row_index_read_size_fail_threshold in cassandra.yaml; queries without partition range limits hitting unbounded partitions.","solutions":["Lower data granularity so partitions are smaller (better partition key design), or raise row_index_read_size_fail_threshold if the workload legitimately needs large partitions","Rewrite queries to narrow the partition/clustering slice so fewer index entries are needed","Run compaction/cleanup and monitor with the warn threshold (row_index_read_size_warn_threshold) to find offending partitions"],"exampleFix":"// cassandra.yaml\n// before\nrow_index_read_size_fail_threshold: 64KiB\n// after\nrow_index_read_size_fail_threshold: 512KiB","handlingStrategy":"validation","validationCode":"// Track partition sizes before they grow unbounded\nlong partitionSize = estimatePartitionSize(keyspace, table, partitionKey);\nlong threshold = Config.getRowIndexReadSizeFailThreshold().toBytes();\nif (partitionSize > threshold) {\n    logger.warn(\"Partition {} exceeds fail threshold {}; reshard data\", partitionKey, threshold);\n}","typeGuard":null,"tryCatchPattern":"try { rs = session.execute(query); }\ncatch (RowIndexEntryReadSizeTooLargeException e) {\n    logger.warn(\"Aborted read of oversized partition: {}\", e.getMessage());\n    // narrow the query or redesign the partition key\n}","preventionTips":["Design partition keys so partitions stay well under the fail threshold","Set row_index_read_size_warn_threshold lower than the fail threshold and monitor warnings","Avoid unbounded partition growth (bucket by time or shard key)"],"tags":["query","row-index","threshold","wide-partition"],"backgroundTag":"payload-too-large","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"}