Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-10369

cqlsh prompt includes name of keyspace after failed `use` statement

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 2.2.2, 3.0.0 rc2
    • None
    • Low

    Description

      I found this while addressing CASSANDRA-10289.

      In cqlsh, if the user enters USE ks, but there is no keyspace named ks, the prompt will read cqlsh:ks>. It should just read cqlsh>, since the underlying session did not actually switch to use ks.

      I believe the bug is in cqlsh and not, e.g., the driver, because the statement, as expected, raises an InvalidRequest error.

      The behavior shows in a test in the cqlshlib nosetests here:

      https://github.com/apache/cassandra/blob/03f556ffa8718754fe4eb329af2002d83ffc7147/pylib/cqlshlib/test/test_cqlsh_output.py#L545

      An example failure on CassCI is here:

      http://cassci.datastax.com/job/scratch_mambocab-fix_cqlsh/11/testReport/cqlshlib.test.test_cqlsh_output/TestCqlshOutput/test_prompt/

      You can also reproduce it trivially in ccm, or however you choose to run clusters locally:

      ccm create cqlsh -v git:trunk -n 1 ; ccm start --wait-for-binary-proto ; ccm node1 cqlsh
      http://git-wip-us.apache.org/repos/asf/cassandra.git git:trunk
      Fetching Cassandra updates...
      Current cluster is now: cqlsh
      Connected to cqlsh at 127.0.0.1:9042.
      [cqlsh 5.0.1 | Cassandra 3.0.0-beta2-SNAPSHOT | CQL spec 3.3.1 | Native protocol v4]
      Use HELP for help.
      cqlsh> use nonexistentkeyspace;
      InvalidRequest: code=2200 [Invalid query] message="Keyspace 'nonexistentkeyspace' does not exist"
      cqlsh:nonexistentkeyspace> 
      

      That last line should read cqlsh> instead.

      Attachments

        Issue Links

          Activity

            People

              snazy Robert Stupp
              mambocab Jim Witschey
              Robert Stupp
              Aleksey Yeschenko
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: