Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
throw more informative error when fail to parse sstable generation
since scylla 5.4, the sstables are named with a uuid-based identifier instead of integer-based one. so the java tools inherited from cassandra 3.x branch do not support it, and throw an `UnsupportedOperationException` when parsing a sstable name with the integer-based generation. like: ```console $ sstablemetadata me-3gbp_1glu_4e6g020ns4px173el0-big-Data.db Exception in thread "main" java.lang.NumberFormatException: For input string: "3gbp_1glu_4e6g020ns4px173el0" at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.base/java.lang.Integer.parseInt(Integer.java:652) at java.base/java.lang.Integer.parseInt(Integer.java:770) at org.apache.cassandra.io.sstable.Descriptor.fromFilename(Descriptor.java:280) at org.apache.cassandra.io.sstable.Descriptor.fromFilename(Descriptor.java:228) at org.apache.cassandra.io.sstable.Descriptor.fromFilename(Descriptor.java:217) at org.apache.cassandra.tools.SSTableMetadataViewer.main(SSTableMetadataViewer.java:150) ``` the user experience is poor when seeing this exception. so let's throw a better exception, so the new output looks like: ```console $ sstablemetadata me-3gbr_0y9h_03n682utcozh4xc6c7-big-Data.db Exception in thread "main" java.lang.UnsupportedOperationException: SSTable 'me-3gbr_0y9h_03n682utcozh4xc6c7-big-Data.db' is using the UUID-based identifier, and hence should be openned using 'scylla sstable' commands at org.apache.cassandra.io.sstable.Descriptor.fromFilename(Descriptor.java:295) at org.apache.cassandra.io.sstable.Descriptor.fromFilename(Descriptor.java:228) at org.apache.cassandra.io.sstable.Descriptor.fromFilename(Descriptor.java:217) at org.apache.cassandra.tools.SSTableMetadataViewer.main(SSTableMetadataViewer.java:150) ``` Fixes scylladb#360 Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
- Loading branch information