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

Missing data from secondary index when secondary index is against a compound PK member

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Duplicate
    • Fix Version/s: 2.0.13
    • Component/s: Feature/2i Index
    • Labels:
      None
    • Severity:
      Normal

      Description

      Under 2.0.8, assuming the following schema:

      CREATE TABLE foo (
      a text,
      b text,
      c text,
      d text,
      PRIMARY KEY (a, b)
      );

      CREATE INDEX foo_b_idx ON foo (b);

      If you do a delete against c or d but specify a and b in the where clause, it will remove the secondary index reference to b (verified that it removes it from the underlying SSTable as well).

      Example:

      cqlsh:test> insert into foo (a, b, c, d) values ('test','test2','to_be_deleted', 'test3');
      cqlsh:test> select * from foo;

      a | b | c | d
      -----------------------+------
      test | test2 | to_be_deleted | test3

      (1 rows)

      cqlsh:test> delete c from foo where a = 'test' and b = 'test2';

      cqlsh:test> select * from foo where b = 'test2';

      (0 rows)

      cqlsh:test> select * from foo where a = 'test' and b = 'test2';

      a | b | c | d
      --------------+------
      test | test2 | null | test3

      (1 rows)

      cqlsh:test> select * from foo;

      a | b | c | d
      --------------+------
      test | test2 | null | test3

      (1 rows)

      Dropping and recreating the index in CQL brings the secondary index reference back.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                samt Sam Tunnicliffe
                Reporter:
                vsukyas Vahram Sukyas
                Authors:
                Sam Tunnicliffe
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: