Cassandra
  1. Cassandra
  2. CASSANDRA-2730

exception generate when using same index names

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Fix Version/s: 0.8.1
    • Component/s: Core
    • Labels:

      Description

      when using cqlsh tool to generate indexes, for example, suppose we have a column family Tuser, which has two columns: name and state.
      cqlsh> create index name_key on Tuser(name);
      cqlsh> create index name_key on Tuser(state);
      note that name_key is used twice by mistake, then a javax.management.InstanceAlreadyExistsException will be thrown and this exception will prevent cassandra service from starting any more.

      1. 2730.txt
        6 kB
        Jonathan Ellis

        Activity

        Hide
        Jonathan Ellis added a comment -

        fix rolled into CASSANDRA-2617 patch

        Show
        Jonathan Ellis added a comment - fix rolled into CASSANDRA-2617 patch
        Hide
        Jonathan Ellis added a comment -

        Attached patch fixes the problem, but requires CASSANDRA-2617 to be finished first.

        Show
        Jonathan Ellis added a comment - Attached patch fixes the problem, but requires CASSANDRA-2617 to be finished first.
        Hide
        Jonathan Ellis added a comment -

        correct

        Show
        Jonathan Ellis added a comment - correct
        Hide
        BAONING WU added a comment -

        so this "drop index" is in 0.8.1? I can't find it in my 0.8.0-rc1.

        Show
        BAONING WU added a comment - so this "drop index" is in 0.8.1? I can't find it in my 0.8.0-rc1.
        Hide
        Cathy Daw added a comment - - edited

        For clarity, this occurs only when you create the same named index referencing different columns

        • Workaround #1: In CQLSH: Prior to restarting server, drop this column family after you see this error, then future server restarts will be fine.
        • Workaround #2: In cassandra-cli: Prior to restarting server, run the "drop index cf column" command for both attempts (birth_year and session_token in my example), then future server restarts will be fine.
        cqlsh> CREATE INDEX birth_year_key ON users (session_token);
        Bad Request: javax.management.InstanceAlreadyExistsException: org.apache.cassandra.db:type=IndexColumnFamilies,keyspace=cqldb,columnfamily=users.birth_year_key
        

        PASS: CQLSH allows multiple indexes without an issue

        cqlsh> CREATE INDEX gender_key ON users (gender);
        cqlsh> CREATE INDEX state_key ON users (state);
        cqlsh> CREATE INDEX birth_year_key ON users (birth_year);
        

        PASS: CQLSH correctly errors out creating the same index twice

        cqlsh> CREATE INDEX birth_year_key ON users (birth_year);
        Bad Request: Index exists
        
        Show
        Cathy Daw added a comment - - edited For clarity, this occurs only when you create the same named index referencing different columns Workaround #1: In CQLSH: Prior to restarting server, drop this column family after you see this error, then future server restarts will be fine. Workaround #2: In cassandra-cli: Prior to restarting server, run the "drop index cf column" command for both attempts (birth_year and session_token in my example), then future server restarts will be fine. cqlsh> CREATE INDEX birth_year_key ON users (session_token); Bad Request: javax.management.InstanceAlreadyExistsException: org.apache.cassandra.db:type=IndexColumnFamilies,keyspace=cqldb,columnfamily=users.birth_year_key PASS: CQLSH allows multiple indexes without an issue cqlsh> CREATE INDEX gender_key ON users (gender); cqlsh> CREATE INDEX state_key ON users (state); cqlsh> CREATE INDEX birth_year_key ON users (birth_year); PASS: CQLSH correctly errors out creating the same index twice cqlsh> CREATE INDEX birth_year_key ON users (birth_year); Bad Request: Index exists

          People

          • Assignee:
            Unassigned
            Reporter:
            BAONING WU
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development