cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tyler Hobbs (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-8206) Deleting columns breaks secondary index on clustering column
Date Wed, 29 Oct 2014 17:23:35 GMT

     [ https://issues.apache.org/jira/browse/CASSANDRA-8206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Tyler Hobbs updated CASSANDRA-8206:
-----------------------------------
    Priority: Critical  (was: Major)
     Summary: Deleting columns breaks secondary index on clustering column  (was: Removing
items from a set breaks secondary index)

It looks like this isn't limited to removing collection items.  Deleting any non-pk column
will remove the index entry for secondary indexes on clustering columns like this:

{noformat}
cqlsh:ks1> CREATE TABLE bar (a int, b int, c int, d int, PRIMARY KEY (a, b));
cqlsh:ks1> CREATE INDEX ON bar (b);
cqlsh:ks1> INSERT INTO bar (a, b, c, d) VALUES (0, 0, 0, 0);
cqlsh:ks1> SELECT * FROM bar WHERE b = 0;

 a | b | c | d
---+---+---+---
 0 | 0 | 0 | 0

(1 rows)
cqlsh:ks1> UPDATE bar SET c = null WHERE a = 0 AND b = 0;
cqlsh:ks1> SELECT * FROM bar WHERE b = 0;

 a | b | c | d
---+---+---+---

(0 rows)
{noformat}

> Deleting columns breaks secondary index on clustering column
> ------------------------------------------------------------
>
>                 Key: CASSANDRA-8206
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8206
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Tuukka Mustonen
>            Assignee: Tyler Hobbs
>            Priority: Critical
>             Fix For: 2.1.2
>
>
> Removing items from a set breaks index for field {{id}}:
> {noformat}
> cqlsh:cs> CREATE TABLE buckets (
>       ...   tenant int,
>       ...   id int,
>       ...   items set<text>,
>       ...   PRIMARY KEY (tenant, id)
>       ... );
> cqlsh:cs> CREATE INDEX buckets_ids ON buckets(id);
> cqlsh:cs> INSERT INTO buckets (tenant, id, items) VALUES (1, 1, {'foo', 'bar'});
> cqlsh:cs> SELECT * FROM buckets;
>  tenant | id | items
> --------+----+----------------
>       1 |  1 | {'bar', 'foo'}
> (1 rows)
> cqlsh:cs> SELECT * FROM buckets WHERE id = 1;
>  tenant | id | items
> --------+----+----------------
>       1 |  1 | {'bar', 'foo'}
> (1 rows)
> cqlsh:cs> UPDATE buckets SET items=items-{'foo'} WHERE tenant=1 AND id=1;
> cqlsh:cs> SELECT * FROM buckets;
>  tenant | id | items
> --------+----+---------
>       1 |  1 | {'bar'}
> (1 rows)
> cqlsh:cs> SELECT * FROM buckets WHERE id = 1;
> (0 rows)
> {noformat}
> Re-building the index fixes the issue:
> {noformat}
> cqlsh:cs> DROP INDEX buckets_ids;
> cqlsh:cs> CREATE INDEX buckets_ids ON buckets(id);
> cqlsh:cs> SELECT * FROM buckets WHERE id = 1;
>  tenant | id | items
> --------+----+---------
>       1 |  1 | {'bar'}
> (1 rows)
> {noformat}
> Adding items does not cause similar failure, only delete. Also didn't test if other collections
are also affected(?)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message