apache/cassandra · critical · RuntimeException
Not enough disk space to store %s
Error message
Not enough disk space to store %s
What it means
If no specific directory was determined for the descriptor, getWriteDirectory asks Directories.getWriteableLocation(estimatedWriteSize) for any data directory with enough free space. A null return (no directory can hold the estimated output) triggers a RuntimeException stating the required size. This prevents starting a compaction that would inevitably fail mid-write.
Source
Thrown at src/java/org/apache/cassandra/db/compaction/writers/CompactionAwareWriter.java:302
logger.trace("All sstables not from the same disk - putting results in {}", descriptor.directory);
break;
}
}
Directories.DataDirectory d = getDirectories().getDataDirectoryForFile(descriptor);
if (d != null)
{
long availableSpace = d.getAvailableSpace();
if (availableSpace < estimatedWriteSize)
throw new RuntimeException(String.format("Not enough space to write %s to %s (%s available)",
FBUtilities.prettyPrintMemory(estimatedWriteSize),
d.location,
FBUtilities.prettyPrintMemory(availableSpace)));
logger.trace("putting compaction results in {}", descriptor.directory);
return d;
}
d = getDirectories().getWriteableLocation(estimatedWriteSize);
if (d == null)
throw new RuntimeException(String.format("Not enough disk space to store %s",
FBUtilities.prettyPrintMemory(estimatedWriteSize)));
return d;
}
public CompactionAwareWriter setRepairedAt(long repairedAt)
{
this.sstableWriter.setRepairedAt(repairedAt);
return this;
}
protected long getExpectedWriteSize()
{
return cfs.getExpectedCompactedFileSize(nonExpiredSSTables, txn.opType());
}
/**
* It is up to the caller to set the following fields:
* - {@link SSTableWriter.Builder#setKeyCount(long)},View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Free space across data directories: drop unneeded snapshots, run nodetool cleanup, truncate/TTL-expire data.
- Add storage capacity or additional data directories.
- Lower estimated write pressure by tuning compaction strategy (smaller compaction targets).
- Check disk_usage settings and monitoring to catch trends before writes fail.
Example fix
// before (shell) # all data dirs < estimatedWriteSize free; compaction throws // after (shell) nodetool clearsnapshot --all && df -h /var/lib/cassandra # verify free space before retrying
Defensive patterns
Strategy: try-catch
Validate before calling
// cluster check before heavy compaction for (String dir : dataDirs) if (new File(dir).getUsableSpace() < minRequiredBytes) alert();
Try / catch
try {
compact();
} catch (RuntimeException e) {
if (e.getMessage().startsWith("Not enough disk space")) { scaleStorage(); }
else throw e;
} Prevention
- Set and monitor disk_usage_percent_warn/fail thresholds
- Automate snapshot cleanup and TTL enforcement
- Provision headroom (e.g. keep <70% disk utilization) so compaction spikes fit
When it happens
Trigger: A compaction calls defaultLocation -> getWriteDirectory when no data directory has at least estimatedWriteSize free (all disks below the blacklisting threshold for the requested size).
Common situations: Cluster-wide disk pressure, one-node disks filled by hints/snapshots, or very large estimated output after a burst of writes.
Related errors
- Not enough space to write %s to %s (%s available)
- Not enough space for compaction (%s) of %s.%s, estimated sst
- Only {} free across all data volumes. Consider adding more c
- concurrent_compactors should be strictly greater than 0, but
- Cannot DROP COMPACT STORAGE as some nodes in the cluster (%s
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/64069ba92e3ad742.
Report an issue: GitHub.