{"record":{"id":"44322268d0e1a1d9","repo":"apache/cassandra","slug":"not-enough-disk-space-for-stream-s-summaries-s","errorCode":null,"errorMessage":"Not enough disk space for stream %s), summaries=%s","messagePattern":"Not enough disk space for stream (.+?)\\), summaries=(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/streaming/StreamSession.java","lineNumber":917,"sourceCode":"     * TODO: Consider revising this to returning a boolean and allowing callers upstream to handle that.\n     */\n    private void checkAvailableDiskSpaceAndCompactions(Collection<StreamSummary> summaries)\n    {\n        if (DatabaseDescriptor.getSkipStreamDiskSpaceCheck())\n            return;\n\n        boolean hasAvailableSpace = true;\n\n        try\n        {\n            hasAvailableSpace = checkAvailableDiskSpaceAndCompactions(summaries, planId(), peer.getHostAddress(true), pendingRepair != null);\n        }\n        catch (Exception e)\n        {\n            logger.error(\"[Stream #{}] Could not check available disk space and compactions for {}, summaries = {}\", planId(), this, summaries, e);\n        }\n        if (!hasAvailableSpace)\n            throw new RuntimeException(String.format(\"Not enough disk space for stream %s), summaries=%s\", this, summaries));\n    }\n\n    /**\n     * Makes sure that we expect to have enough disk space available for the new streams, taking into consideration\n     * the ongoing compactions and streams.\n     */\n    @VisibleForTesting\n    public static boolean checkAvailableDiskSpaceAndCompactions(Collection<StreamSummary> summaries,\n                                                                @Nullable TimeUUID planId,\n                                                                @Nullable String remoteAddress,\n                                                                boolean isForIncremental)\n    {\n        Map<TableId, Long> perTableIdIncomingBytes = new HashMap<>();\n        Map<TableId, Integer> perTableIdIncomingFiles = new HashMap<>();\n        long newStreamTotal = 0;\n        for (StreamSummary summary : summaries)\n        {\n            perTableIdIncomingFiles.merge(summary.tableId, summary.files, Integer::sum);","sourceCodeStart":899,"sourceCodeEnd":935,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/streaming/StreamSession.java#L899-L935","documentation":"Before accepting an incoming stream prepare, the node estimates the disk space the requested stream summaries would consume, accounting for ongoing compactions. If projected free space is insufficient it throws this RuntimeException, refusing the stream to avoid filling the disk.","triggerScenarios":"prepareAsync or prepareSynAck calling checkAvailableDiskSpaceAndCompactions and finding !hasAvailableSpace — the requested summaries' total size exceeds available disk space given current compaction reserves.","commonSituations":"Streaming a large amount of data (bootstrap, repair, decommission) onto a node whose disks are nearly full; many concurrent compactions reserving space; under-provisioned nodes in busy clusters.","solutions":["Free disk space on the streaming target node (run cleanup, nodetool compaction, archive/delete old snapshots).","Reduce concurrency: run nodetool stop followed by smaller batches of repair/rebuild so less data streams at once.","Lower concurrent_compactors / compaction throughput temporarily to reduce reserved space, or wait for compactions to finish.","Expand disk capacity or rebalance tokens so less data lands on the full node.","Monitor with nodetool diskusage / metrics (disk utilization, stream totals) before starting large streams."],"exampleFix":"// before\n// node ran out of space mid-stream\n// after\n// check before streaming:\nlong usable = diskUsableBytes(targetDir);\nlong needed = summaries.stream().mapToLong(s -> s.estimateSize()).sum();\nif (usable < needed * 2) {\n    throw new IllegalStateException(\"Refusing stream: insufficient disk space\");\n}","handlingStrategy":"validation","validationCode":"long usable = fileStore.getUsableSpace();\nlong needed = summaries.stream().mapToLong(StreamSummary::getTotalSize).sum();\nif (usable < needed * 2) { /* free space or refuse */ }","typeGuard":null,"tryCatchPattern":"try { session.prepare(msg); } catch (RuntimeException e) { if (e.getMessage().contains(\"Not enough disk space\")) { cleanupDisk(); retryLater(); } else { throw e; } }","preventionTips":["Alert on disk usage (keep > 50% free) before running repairs, rebuilds, or bootstraps.","Stagger large streaming operations across the cluster.","Run nodetool cleanup and clear stale snapshots routinely.","Provision disk headroom for compaction plus streaming simultaneously."],"tags":["streaming","disk-space","capacity"],"backgroundTag":"insufficient-disk-space","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}