Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch java tools print a message when they see a UUID generation #360

Closed
Tracked by #14856
tchaikov opened this issue Dec 8, 2023 · 3 comments · Fixed by #362
Closed
Tracked by #14856

patch java tools print a message when they see a UUID generation #360

tchaikov opened this issue Dec 8, 2023 · 3 comments · Fixed by #362
Assignees

Comments

@tchaikov
Copy link
Contributor

tchaikov commented Dec 8, 2023

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 exception, like

root@df13a4d04afa:/var/lib/scylla/data/foo/bar-eb90daf0952d11ee87e220c83109c794# 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)
root@df13a4d04afa:/var/lib/scylla/data/foo/bar-eb90daf0952d11ee87e220c83109c794# sstabledump '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.SSTableExport.run(SSTableExport.java:188)
	at com.scylladb.tools.SSTableExport.main(SSTableExport.java:44)

we should patch java tools print a message when they see a UUID generation, telling the user to use the native tools for sstables with UUID generation.

@mykaul
Copy link
Contributor

mykaul commented Dec 9, 2023

This is very important to fix, as the user experience is very poor.

tchaikov added a commit to tchaikov/scylla-tools-java that referenced this issue Dec 11, 2023
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>
tchaikov added a commit to tchaikov/scylla-tools-java that referenced this issue Dec 11, 2023
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>
tchaikov added a commit to tchaikov/scylla-tools-java that referenced this issue Dec 11, 2023
this change is a refactory. which enables us to add a try-catch
clause to handle UnsupportedOperationException without introducing
a large code churn.

Refs scylladb#360
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
tchaikov added a commit to tchaikov/scylla-tools-java that referenced this issue Dec 11, 2023
so we don't greet user with a backtrace if, for instance, the
sstable being inspected is named with UUID-based identifier.

Fixes scylladb#360
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
tchaikov added a commit to tchaikov/scylla-tools-java that referenced this issue Dec 11, 2023
this change is a refactory. which enables us to add a try-catch
clause to handle UnsupportedOperationException without introducing
a large code churn.

Refs scylladb#360
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
tchaikov added a commit to tchaikov/scylla-tools-java that referenced this issue Dec 11, 2023
so we don't greet user with a backtrace if, for instance, the
sstable being inspected is named with UUID-based identifier.

after this change, if the sstable's identifier is UUID-based, the
tool would print a more user-friendly message in the stderr:

```console
$ sstabledump  /home/kefu/.dtest/dtest-8xbyk741/test/node3/data/ks/test-4517d910968d11ee84e4ebb027ebcc17/me-3gbr_0z07_0dpts20r5i40t9onx3-big-Data.db
SSTable 'me-3gbr_0z07_0dpts20r5i40t9onx3-big-Data.db' uses UUID-based identifier. Please use 'scylla sstable' commands.
```

because, in theory, these tools are able to handle multiple
sstables, so the failure to parse the sstable filename does not
fail the whole command. this peserves the existing behavior.

Fixes scylladb#360
Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
@denesb denesb closed this as completed in c8b6c45 Dec 11, 2023
denesb added a commit that referenced this issue Dec 11, 2023
…tion" from Kefu Chai

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:

$ 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.

after this change, if the sstable's identifier is UUID-based, the tool would print a more user-friendly message in the stderr:

$ sstabledump  /home/kefu/.dtest/dtest-8xbyk741/test/node3/data/ks/test-4517d910968d11ee84e4ebb027ebcc17/me-3gbr_0z07_0dpts20r5i40t9onx3-big-Data.db
SSTable 'me-3gbr_0z07_0dpts20r5i40t9onx3-big-Data.db' uses UUID-based identifier. Please use 'scylla sstable' commands.

Fixes #360
Fixes #362
Signed-off-by: Kefu Chai kefu.chai@scylladb.com

* github.com:scylladb/scylla-tools-java:
  tools: catch and print UnsupportedOperationException
  tools/SSTableMetadataViewer: continue if sstable does not exist
  throw more informative error when fail to parse sstable generation
denesb added a commit to scylladb/scylladb that referenced this issue Dec 11, 2023
* ./tools/java 26f5f71c...29fe44da (3):
  > tools: catch and print UnsupportedOperationException
  > tools/SSTableMetadataViewer: continue if sstable does not exist
  > throw more informative error when fail to parse sstable generation

Fixes: scylladb/scylla-tools-java#360
@mykaul
Copy link
Contributor

mykaul commented Dec 11, 2023

I assume we'll have also a backport to 5.4 of the submodule update?

denesb added a commit that referenced this issue Dec 12, 2023
…tion" from Kefu Chai

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:

$ 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.

after this change, if the sstable's identifier is UUID-based, the tool would print a more user-friendly message in the stderr:

$ sstabledump  /home/kefu/.dtest/dtest-8xbyk741/test/node3/data/ks/test-4517d910968d11ee84e4ebb027ebcc17/me-3gbr_0z07_0dpts20r5i40t9onx3-big-Data.db
SSTable 'me-3gbr_0z07_0dpts20r5i40t9onx3-big-Data.db' uses UUID-based identifier. Please use 'scylla sstable' commands.

Fixes #360
Fixes #362
Signed-off-by: Kefu Chai kefu.chai@scylladb.com

* github.com:scylladb/scylla-tools-java:
  tools: catch and print UnsupportedOperationException
  tools/SSTableMetadataViewer: continue if sstable does not exist
  throw more informative error when fail to parse sstable generation

(cherry picked from commit 29fe44d)
denesb added a commit to scylladb/scylladb that referenced this issue Dec 12, 2023
* tools/java 3764ae94...f9cce789 (1):
  > Merge "print more informative error when fail to parse sstable generation" from Kefu Chai

Fixes: scylladb/scylla-tools-java#360
@denesb
Copy link
Contributor

denesb commented Dec 12, 2023

Backported to 5.4 as f9cce78 and scylladb/scylladb@0518e47.

dgarcia360 pushed a commit to dgarcia360/scylla that referenced this issue Apr 30, 2024
* ./tools/java 26f5f71c...29fe44da (3):
  > tools: catch and print UnsupportedOperationException
  > tools/SSTableMetadataViewer: continue if sstable does not exist
  > throw more informative error when fail to parse sstable generation

Fixes: scylladb/scylla-tools-java#360
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants