Summary
This article discusses an issue where a Cassandra utility such as sstable2json
fails with a Java IO exception.
Symptoms
When attempting to convert an SSTable using the sstable2json
, it fails with an IO exception. For example:
$ sstable2json musicKS-album-ka-5678-Data.db > album-5678.json java.io.IOException: Error writing output stream at org.apache.cassandra.tools.SSTableExport.checkStream(SSTableExport.java:82) at org.apache.cassandra.tools.SSTableExport.export(SSTableExport.java:344) at org.apache.cassandra.tools.SSTableExport.export(SSTableExport.java:369) at org.apache.cassandra.tools.SSTableExport.export(SSTableExport.java:382) at org.apache.cassandra.tools.SSTableExport.main(SSTableExport.java:467)
Cause
When converting an SSTable to JSON format, the utility requires space to unpack the data file and temporarily serialise the rows to disk as part of the call to SSTableExport.export()
. This operation can fail for multiple reasons:
- insufficient disk space available
- incorrect permissions on filesystem
Solution
Ensure you have sufficient disk space available, particularly for very large SSTables. In most cases where the SSTables are compressed, allow at least 1.5x to 2x the size of the SSTable free space.
Also confirm that the user has the necessary permissions on the filesystem otherwise the output stream will also fail.