[ 
https://issues.apache.org/jira/browse/CASSANDRA-4464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13572408#comment-13572408
 ] 

Jason Brown commented on CASSANDRA-4464:
----------------------------------------

Looking into it, nodetool's interface is like this:

{code}snapshot [keyspaces...] -cf [columnfamilyName] -t [snapshotName]{code}

If you execute this (on a KS named jason, with a CF named dog, with index 
age_idx):

{code}nodetool snapshot jason -cf dog.age_idx{code}

you get this output:

{code}Requested snapshot for: jeb and column family: dog.age_idx
Exception in thread "main" java.lang.IllegalArgumentException: Cannot take a 
snapshot of a secondary index by itself. Run snapshot on the column family that 
owns the index.
        at 
org.apache.cassandra.service.StorageService.takeColumnFamilySnapshot(StorageService.java:2164)
…{code}

Not an unreasonable message, I hope. That said, I'd prefer to catch the 
exception and make a prettier (less verbose) message, but if I catch the 
exception rather than let it escape out of main(), I wouldn't have a chance to 
set the exit status code to a non-0 value (at least, not without bypassing the 
finally{} block at the end of main()).

However, that does not match the exception message you mentioned, "that the CF 
does not exist". I think that comes from SS.takeSnapshot(), which would print 
"Table dog.age_idx does not exist" if you execute it like this:

{code}nodetool snapshot dog.age_idx{code}

In this case, it is true, 'dog.age_idx' does not exist as a table/keyspace, as 
NodeCmd is expecting keyspace names as parameters. However, we can (trivially) 
change the message to say 'Keyspace xyz does not exist' (in SS.getValidTable()) 
to make it a little clearer to users. When they realize the the correct syntax 
of the nodetool snapshot command, they'll run into the IAE (like above), so 
that should stop them from trying to do any more damage :).

Please let me know if I'm missing something here.

                
> expose 2I CFs to the rest of nodetool
> -------------------------------------
>
>                 Key: CASSANDRA-4464
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4464
>             Project: Cassandra
>          Issue Type: New Feature
>          Components: Tools
>            Reporter: Jonathan Ellis
>            Assignee: Jason Brown
>            Priority: Minor
>             Fix For: 1.2.2
>
>         Attachments: 4464.txt, 4464-v1.patch, 4464-v2.patch
>
>
> This was begun in CASSANDRA-4063.  We should extend it to scrub as well, and 
> probably compact since any sane way to do it for scrub should give the other 
> for free.
> Not sure how easy these will be since they go through CompactionManager via 
> StorageProxy.  I think getValidColumnFamilies could be updated to check for 
> index CFs with "dot notation."
> (Other operations like flush or snapshot don't make sense for 2I CFs in 
> isolation of their parent.)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to