Cassandra
  1. Cassandra
  2. CASSANDRA-3865

Cassandra-cli returns 'command not found' instead of syntax error

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Fix Version/s: 1.1.2
    • Component/s: Core
    • Labels:
    • Environment:

      DSE 1.0.5

      Description

      When creating a column family from the output of 'show schema' with an index, there is a trailing comma after "index_type: 0," The return from this is a 'command not found' This is misleading because the command is found, there is just a syntax error.

      'Command not found: `create column family $cfname ...`

      1. parse_doubles_better.txt
        0.4 kB
        Dave Brosius
      2. 3865_better_cli_ex_handling.txt
        1 kB
        Dave Brosius

        Activity

        Eric Lubow created issue -
        Jonathan Ellis made changes -
        Field Original Value New Value
        Assignee Yuki Morishita [ yukim ]
        Priority Major [ 3 ] Trivial [ 5 ]
        Reviewer brandon.williams
        Hide
        Yuki Morishita added a comment -

        This is fixed in 1.0.7 (CASSANDRA-3714).

        Show
        Yuki Morishita added a comment - This is fixed in 1.0.7 ( CASSANDRA-3714 ).
        Jonathan Ellis made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Yuki Morishita [ yukim ]
        Reviewer brandon.williams
        Resolution Duplicate [ 3 ]
        Hide
        Eric Lubow added a comment -

        This doesn't appear to be fixed.

        Welcome to Cassandra CLI version 1.0.8

        Type 'help;' or '?' for help.
        Type 'quit;' or 'exit;' to quit.

        [default@linkcurrent] create column family social_poll_deltas
        ... with column_type = 'Standard'
        ... and comparator = 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.LongType)'
        ... and default_validation_class = 'UUIDType'
        ... and key_validation_class = 'UUIDType'
        ... and rows_cached = 0.0
        ... and row_cache_save_period = 0
        ... and row_cache_keys_to_save = 2147483647
        ... and keys_cached = 200000.0
        ... and key_cache_save_period = 14400
        ... and read_repair_chance = .25
        ... and gc_grace = 864000
        ... and min_compaction_threshold = 4
        ... and max_compaction_threshold = 32
        ... and replicate_on_write = true
        ... and row_cache_provider = 'SerializingCacheProvider'
        ... and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
        ... and comment = 'Social poll totals and deltas ';
        Command not found: `create column family social_poll_deltas with column_type = 'Standard' and comparator = 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.LongType)' and default_validation_class = 'UUIDType' and key_validation_class = 'UUIDType' and rows_cached = 0.0 and row_cache_save_period = 0 and row_cache_keys_to_save = 2147483647 and keys_cached = 200000.0 and key_cache_save_period = 14400 and read_repair_chance = .25 and gc_grace = 864000 and min_compaction_threshold = 4 and max_compaction_threshold = 32 and replicate_on_write = true and row_cache_provider = 'SerializingCacheProvider' and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' and comment = 'Social poll totals and deltas ';`. Type 'help;' or '?' for help.

        Show
        Eric Lubow added a comment - This doesn't appear to be fixed. Welcome to Cassandra CLI version 1.0.8 Type 'help;' or '?' for help. Type 'quit;' or 'exit;' to quit. [default@linkcurrent] create column family social_poll_deltas ... with column_type = 'Standard' ... and comparator = 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.LongType)' ... and default_validation_class = 'UUIDType' ... and key_validation_class = 'UUIDType' ... and rows_cached = 0.0 ... and row_cache_save_period = 0 ... and row_cache_keys_to_save = 2147483647 ... and keys_cached = 200000.0 ... and key_cache_save_period = 14400 ... and read_repair_chance = .25 ... and gc_grace = 864000 ... and min_compaction_threshold = 4 ... and max_compaction_threshold = 32 ... and replicate_on_write = true ... and row_cache_provider = 'SerializingCacheProvider' ... and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' ... and comment = 'Social poll totals and deltas '; Command not found: `create column family social_poll_deltas with column_type = 'Standard' and comparator = 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.LongType)' and default_validation_class = 'UUIDType' and key_validation_class = 'UUIDType' and rows_cached = 0.0 and row_cache_save_period = 0 and row_cache_keys_to_save = 2147483647 and keys_cached = 200000.0 and key_cache_save_period = 14400 and read_repair_chance = .25 and gc_grace = 864000 and min_compaction_threshold = 4 and max_compaction_threshold = 32 and replicate_on_write = true and row_cache_provider = 'SerializingCacheProvider' and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' and comment = 'Social poll totals and deltas ';`. Type 'help;' or '?' for help.
        Jonathan Ellis made changes -
        Resolution Duplicate [ 3 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Assignee Yuki Morishita [ yukim ]
        Hide
        Eric Lubow added a comment -

        As an update, the problem with this (after MUCH trial and error), was that the read_repair_chance was .25 instead of 0.25.

        Show
        Eric Lubow added a comment - As an update, the problem with this (after MUCH trial and error), was that the read_repair_chance was .25 instead of 0.25.
        Hide
        Dave Brosius added a comment - - edited

        support decimal parsing as 0.5 and .5

        against trunk

        Show
        Dave Brosius added a comment - - edited support decimal parsing as 0.5 and .5 against trunk
        Dave Brosius made changes -
        Attachment parse_doubles_better.txt [ 12528837 ]
        Dave Brosius made changes -
        Status Reopened [ 4 ] Patch Available [ 10002 ]
        Jonathan Ellis made changes -
        Assignee Yuki Morishita [ yukim ] Dave Brosius [ dbrosius ]
        Fix Version/s 1.0.11 [ 12321255 ]
        Fix Version/s 1.1.1 [ 12319857 ]
        Reviewer xedin
        Hide
        Yuki Morishita added a comment -

        That't one way to fix parsing problem, but in my understanding, what Eric is saying is that it's hard to find the error from the message above.
        If we can display more user friendly message like "Parse error: read_repair_chance = .25", instead of saying "Command not found", user can easily fix what's wrong.

        I'm fine with current Double definition if we can fix the error message. What do you think, Pavel?

        Show
        Yuki Morishita added a comment - That't one way to fix parsing problem, but in my understanding, what Eric is saying is that it's hard to find the error from the message above. If we can display more user friendly message like "Parse error: read_repair_chance = .25", instead of saying "Command not found", user can easily fix what's wrong. I'm fine with current Double definition if we can fix the error message. What do you think, Pavel?
        Hide
        Eric Lubow added a comment -

        As Yuki said, I'd be more interested in the fix being a complaint of a syntax error (or parse error) when attempting to create a column family as opposed to "command not found" (which is clearly ambiguous). This way I (as a user) know that the CLI is aware that I am attempting to create a column family and it's failing. Now not only do I know that I am on the right track with the command I'm trying to execute, but then I know roughly where the problem is. Fixing the parse error is just a band-aid.

        Show
        Eric Lubow added a comment - As Yuki said, I'd be more interested in the fix being a complaint of a syntax error (or parse error) when attempting to create a column family as opposed to "command not found" (which is clearly ambiguous). This way I (as a user) know that the CLI is aware that I am attempting to create a column family and it's failing. Now not only do I know that I am on the right track with the command I'm trying to execute, but then I know roughly where the problem is. Fixing the parse error is just a band-aid.
        Hide
        Pavel Yaskevich added a comment - - edited

        I think that Dave's patch is one part of it, another would be to change "Command not found" to "Error in the command" and add information from RecognitionException (which NoViableAltException extends) to were recognition error have actually happend.

        Edit: Also, Dave, please don't forget that this is intended for inclusion into 1.0 so patches should be against cassandra-1.0 branch instead.

        Show
        Pavel Yaskevich added a comment - - edited I think that Dave's patch is one part of it, another would be to change "Command not found" to "Error in the command" and add information from RecognitionException (which NoViableAltException extends) to were recognition error have actually happend. Edit: Also, Dave, please don't forget that this is intended for inclusion into 1.0 so patches should be against cassandra-1.0 branch instead.
        Hide
        Jonathan Ellis added a comment -

        My fault, I added 1.0 as a fix target after Dave's patch since I thought it was going to be a quick fix. Let's target 1.1 instead.

        Show
        Jonathan Ellis added a comment - My fault, I added 1.0 as a fix target after Dave's patch since I thought it was going to be a quick fix. Let's target 1.1 instead.
        Jonathan Ellis made changes -
        Fix Version/s 1.1.2 [ 12321445 ]
        Fix Version/s 1.1.1 [ 12319857 ]
        Fix Version/s 1.0.11 [ 12321255 ]
        Hide
        Dave Brosius added a comment -

        3865_better_cli_ex_handling.txt

        has better decimal parsing as before.

        Also has better error messaging when the exception is NoViableAltException.

        For some reason the code special cased that exception and returned the non-useful "Command not found" message. I just removed the special casing and now the message is useful.

        If there is some case that someone knows about that the message "Command not found" is useful, i can put it back in for that specific case, but i couldn't see it.

        against cassandra-1.1

        Show
        Dave Brosius added a comment - 3865_better_cli_ex_handling.txt has better decimal parsing as before. Also has better error messaging when the exception is NoViableAltException. For some reason the code special cased that exception and returned the non-useful "Command not found" message. I just removed the special casing and now the message is useful. If there is some case that someone knows about that the message "Command not found" is useful, i can put it back in for that specific case, but i couldn't see it. against cassandra-1.1
        Dave Brosius made changes -
        Attachment 3865_better_cli_ex_handling.txt [ 12529462 ]
        Hide
        Pavel Yaskevich added a comment -

        +1

        Show
        Pavel Yaskevich added a comment - +1
        Hide
        Dave Brosius added a comment -

        committed to branch cassandra-1.1 as commit 2d72056c14f9b97e67dd94e48691f3ec1a88d9d6

        Show
        Dave Brosius added a comment - committed to branch cassandra-1.1 as commit 2d72056c14f9b97e67dd94e48691f3ec1a88d9d6
        Hide
        Pavel Yaskevich added a comment -

        You also need to add line about that into CHANGES.txt and up-merge it into trunk.

        Show
        Pavel Yaskevich added a comment - You also need to add line about that into CHANGES.txt and up-merge it into trunk.
        Hide
        Pavel Yaskevich added a comment -

        ok, I did CHANGES.txt update and merge for you this time

        Show
        Pavel Yaskevich added a comment - ok, I did CHANGES.txt update and merge for you this time
        Pavel Yaskevich made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Hudson added a comment -

        Integrated in Cassandra #1453 (See https://builds.apache.org/job/Cassandra/1453/)
        add missing CHANGES.txt entry for CASSANDRA-3865 (Revision d16c4468e86fbdb82ed981ef6c6ced6f275e4f21)

        Result = FAILURE
        xedin :
        Files :

        • CHANGES.txt
        Show
        Hudson added a comment - Integrated in Cassandra #1453 (See https://builds.apache.org/job/Cassandra/1453/ ) add missing CHANGES.txt entry for CASSANDRA-3865 (Revision d16c4468e86fbdb82ed981ef6c6ced6f275e4f21) Result = FAILURE xedin : Files : CHANGES.txt
        Hide
        Pavel Yaskevich added a comment -

        I have fixed small bug and committed to 1.1 and up-merged into trunk.

        Show
        Pavel Yaskevich added a comment - I have fixed small bug and committed to 1.1 and up-merged into trunk.
        Hide
        Hudson added a comment -

        Integrated in Cassandra #1455 (See https://builds.apache.org/job/Cassandra/1455/)
        fixes small CLI bug introduced by CASSANDRA-3865 (Revision 46722cc69e47e9b4bdcc5c28f426cf7f0a6a3a7d)

        Result = FAILURE
        xedin :
        Files :

        • src/java/org/apache/cassandra/cli/Cli.g
        Show
        Hudson added a comment - Integrated in Cassandra #1455 (See https://builds.apache.org/job/Cassandra/1455/ ) fixes small CLI bug introduced by CASSANDRA-3865 (Revision 46722cc69e47e9b4bdcc5c28f426cf7f0a6a3a7d) Result = FAILURE xedin : Files : src/java/org/apache/cassandra/cli/Cli.g
        Gavin made changes -
        Workflow no-reopen-closed, patch-avail [ 12652188 ] patch-available, re-open possible [ 12749269 ]
        Gavin made changes -
        Workflow patch-available, re-open possible [ 12749269 ] reopen-resolved, no closed status, patch-avail, testing [ 12756899 ]

          People

          • Assignee:
            Dave Brosius
            Reporter:
            Eric Lubow
            Reviewer:
            Pavel Yaskevich
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development