{"record":{"id":"03c7f4f6906c5509","repo":"apache/cassandra","slug":"truncate-timed-out-received-only-responses-res","errorCode":null,"errorMessage":"Truncate timed out - received only {responses} responses","messagePattern":"Truncate timed out - received only (.+?) responses","errorType":"exception","errorClass":"TimeoutException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/TruncateResponseHandler.java","lineNumber":77,"sourceCode":"        this.responseCount = responseCount;\n        start = nanoTime();\n    }\n\n    public void get() throws TimeoutException\n    {\n        long timeoutNanos = getTruncateRpcTimeout(NANOSECONDS) - (nanoTime() - start);\n        boolean signaled;\n        try\n        {\n            signaled = condition.await(timeoutNanos, NANOSECONDS); // TODO truncate needs a much longer timeout\n        }\n        catch (InterruptedException e)\n        {\n            throw new UncheckedInterruptedException(e);\n        }\n\n        if (!signaled)\n            throw new TimeoutException(\"Truncate timed out - received only \" + responses.get() + \" responses\");\n\n        if (!failureReasonByEndpoint.isEmpty())\n        {\n            // clone to make sure no race condition happens\n            Map<InetAddressAndPort, RequestFailureReason> failureReasonByEndpoint = new HashMap<>(this.failureReasonByEndpoint);\n            if (RequestCallback.isTimeout(failureReasonByEndpoint))\n                throw new TimeoutException(\"Truncate timed out - received only \" + responses.get() + \" responses\");\n\n            StringBuilder sb = new StringBuilder(\"Truncate failed on \");\n            for (Map.Entry<InetAddressAndPort, RequestFailureReason> e : failureReasonByEndpoint.entrySet())\n                sb.append(\"replica \").append(e.getKey()).append(\" -> \").append(e.getValue()).append(\", \");\n            sb.setLength(sb.length() - 2);\n            throw new TruncateException(sb.toString());\n        }\n    }\n\n    @Override\n    public void onResponse(Message<TruncateResponse> message)","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/TruncateResponseHandler.java#L59-L95","documentation":"Thrown by TruncateResponseHandler.get() when the coordinator does not receive acknowledgements from all required replicas for a TRUNCATE command within the truncation request timeout. It indicates at least one replica did not confirm the truncation in time, so the coordinator cannot guarantee the table data was removed everywhere.","triggerScenarios":"Running TRUNCATE (or via Table.truncate) when one or more replicas holding the table fail to respond to the TruncateVerb before the request timeout expires; responses.get() counts acks received so far.","commonSituations":"A replica node is down, overloaded (GC pauses, overloaded coordinator), network latency/partition between coordinator and replicas, or truncating a very large table where replica-side truncation work exceeds the timeout.","solutions":["Check nodetool status / logs on replicas holding the table and restart or repair any down or unresponsive replica, then retry the TRUNCATE.","Raise the timeout: increase truncate_request_timeout_in_ms (and request_timeout_in_ms) in cassandra.yaml.","Retry the TRUNCATE after the cluster is healthy; truncation is idempotent for remaining data.","If a replica permanently failed the truncation, inspect its logs for TruncateException and run repair or re-truncate after fixing it."],"exampleFix":"// before (cassandra.yaml)\ntruncate_request_timeout_in_ms: 60000\n// after\ntruncate_request_timeout_in_ms: 120000","handlingStrategy":"try-catch","validationCode":"// before truncate\nClusterHealth ok = replicasUpForTable(keyspace, table); // nodetool status / driver metadata\nif (!ok.allReplicasUp()) throw new IllegalStateException(\"Fix replicas before TRUNCATE\");","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(\"TRUNCATE ks.tbl\");\n} catch (TimeoutException e) {\n    logger.warn(\"Truncate timed out; verify replicas then retry\", e);\n    retryTruncateWithBackoff(keyspace, table);\n}","preventionTips":["Keep truncate_request_timeout_in_ms generous relative to your largest table.","Monitor replica health and avoid truncating while replicas are down or overloaded.","Run TRUNCATE during maintenance windows."],"tags":["timeout","truncate","replica-consistency","distributed"],"backgroundTag":"request-timeout","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"}