{"record":{"id":"be58a4e1a3b6af69","repo":"apache/cassandra","slug":"read-on-table-s-has-exceeded-the-size-failure-thr","errorCode":null,"errorMessage":"Read on table %s has exceeded the size failure threshold of %,d bytes with ...","messagePattern":"Read on table (.+?) has exceeded the size failure threshold of %,d bytes with \\.\\.\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/SelectStatement.java","lineNumber":1155,"sourceCode":"            String msg = String.format(\"Read on table %s has exceeded the size warning threshold of %,d bytes\", table, options.getCoordinatorReadSizeWarnThresholdBytes());\n            ClientState state = ClientState.forInternalCalls();\n            ClientWarn.instance.warn(msg + \" with \" + loggableTokens(options, state));\n            logger.warn(\"{} with query {}\", msg, asCQL(options, state));\n            if (store != null)\n                store.metric.coordinatorReadSizeWarnings.mark();\n        }\n    }\n\n    private void maybeFail(ResultSetBuilder result, QueryOptions options)\n    {\n        if (!options.isReadThresholdsEnabled())\n            return;\n        if (result.shouldReject(options.getCoordinatorReadSizeAbortThresholdBytes()))\n        {\n            String msg = String.format(\"Read on table %s has exceeded the size failure threshold of %,d bytes\", table, options.getCoordinatorReadSizeAbortThresholdBytes());\n            ClientState state = ClientState.forInternalCalls();\n            String clientMsg = msg + \" with \" + loggableTokens(options, state);\n            ClientWarn.instance.warn(clientMsg);\n            logger.warn(\"{} with query {}\", msg, asCQL(options, state));\n            ColumnFamilyStore store = cfs();\n            if (store != null)\n            {\n                store.metric.coordinatorReadSizeAborts.mark();\n                store.metric.coordinatorReadSize.update(result.getSize());\n            }\n            // read errors require blockFor and recieved (its in the protocol message), but this isn't known;\n            // to work around this, treat the coordinator as the only response we care about and mark it failed\n            ReadSizeAbortException exception = new ReadSizeAbortException(clientMsg, options.getConsistency(), 0, 1, true,\n                                                                          ImmutableMap.of(FBUtilities.getBroadcastAddressAndPort(), RequestFailureReason.READ_SIZE));\n            StorageProxy.recordReadRegularAbort(options.getConsistency(), exception);\n            throw exception;\n        }\n    }\n\n    private ColumnFamilyStore cfs()\n    {","sourceCodeStart":1137,"sourceCodeEnd":1173,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java#L1137-L1173","documentation":"When a coordinator read result exceeds cassandra.coordinator_read_size_failure_threshold_kb, the query is rejected with an exception to protect the coordinator from OOM, and the client also receives this warning text via ClientWarn before the failure is raised.","triggerScenarios":"SELECT whose computed result size crosses the abort/failure threshold; result.shouldReject(options.getCoordinatorReadSizeAbortThresholdBytes()) triggers rejection; the coordinator aborts the read.","commonSituations":"Reading multi-GB partitions; thresholds tightened for stability; unbounded scans on tables with poor data models; large IN queries over wide partitions.","solutions":["Restrict the query with partition key and LIMIT so the result stays under the threshold","Page the read (driver fetch size) so each page is bounded","Raise cassandra.coordinator_read_size_failure_threshold_kb only with capacity planning","Redesign the data model to bound partition sizes"],"exampleFix":"// before\nSELECT * FROM events; // exceeds failure threshold, aborted\n// after\nSELECT * FROM events WHERE day = ? AND device_id = ? LIMIT 5000; // bounded read","handlingStrategy":"try-catch","validationCode":"if (!cql.toLowerCase().contains(\"limit\") && !hasPartitionKeyRestriction(cql)) {\n    throw new IllegalArgumentException(\"read would likely exceed failure threshold; add LIMIT\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(stmt);\n} catch (DriverException e) {\n    if (e.getMessage().contains(\"exceeded the size failure threshold\")) {\n        // retry with paging / narrower WHERE / LIMIT\n    } else throw e;\n}","preventionTips":["Bound partition sizes in the data model","Page all large reads","Watch coordinator_read_size_aborts metric","Review failure-threshold config after version upgrades"],"tags":["cassandra","read-size","guardrail","query-rejected"],"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"}