You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "graham sanderson (JIRA)" <ji...@apache.org> on 2014/07/08 04:05:33 UTC

[jira] [Updated] (CASSANDRA-7490) Static columns mess up selects with ordering and clustering column ranges

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

graham sanderson updated CASSANDRA-7490:
----------------------------------------

    Attachment: fix.patch
                test.patch

Added a test case that reproduces a bunch of similar problems, and a fix

Note I could not find a way to cover the last line of the fix in my test case but it looks right - any ideas?

> Static columns mess up selects with ordering and clustering column ranges
> -------------------------------------------------------------------------
>
>                 Key: CASSANDRA-7490
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7490
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>            Reporter: graham sanderson
>         Attachments: fix.patch, test.patch
>
>
> Starts off ok:
> {code}
> cqlsh:test> create table test (p text, c text, v text, s text static, PRIMARY KEY (p, c));
> cqlsh:test> insert into test (p, c, v, s) values ('p1', 'k1', 'v1', 'sv1');
> cqlsh:test> select * from test where p = 'p1';
>  p  | c  | s   | v
> ----+----+-----+----
>  p1 | k1 | sv1 | v1
> (1 rows)
> {code}
> But try ordering, and we appear to get the static row instead:
> {code}
> cqlsh:test> select * from test where p = 'p1' order by c desc;
>  p  | c    | s   | v
> ----+------+-----+------
>  p1 | null | sv1 | null
> (1 rows)
> {code}
> Now we add a clustering key range constraint, again works ok:
> {code}
> cqlsh:test> select * from test where p = 'p1' and c >= 'a';
>  p  | c  | s   | v
> ----+----+-----+----
>  p1 | k1 | sv1 | v1
> (1 rows)
> {code}
> But, this causes assertion failure (which has a very nice comment explaining exactly why that might happen!):
> {code}
> cqlsh:test> select * from test where p = 'p1' and c >= 'a' order by c desc;
> Request did not complete within rpc_timeout.
> {code}
> Cause:
> {code}
> java.lang.AssertionError: Added column does not sort as the first column
>         at org.apache.cassandra.db.ArrayBackedSortedColumns.addColumn(ArrayBackedSortedColumns.java:115)
>         at org.apache.cassandra.db.ColumnFamily.addColumn(ColumnFamily.java:116)
>         at org.apache.cassandra.db.ColumnFamily.addIfRelevant(ColumnFamily.java:110)
>         at org.apache.cassandra.db.filter.SliceQueryFilter.collectReducedColumns(SliceQueryFilter.java:205)
>         at org.apache.cassandra.db.filter.QueryFilter.collateColumns(QueryFilter.java:122)
>         at org.apache.cassandra.db.filter.QueryFilter.collateOnDiskAtom(QueryFilter.java:80)
>         at org.apache.cassandra.db.filter.QueryFilter.collateOnDiskAtom(QueryFilter.java:72)
>         at org.apache.cassandra.db.CollationController.collectAllData(CollationController.java:297)
>         at org.apache.cassandra.db.CollationController.getTopLevelColumns(CollationController.java:53)
>         at org.apache.cassandra.db.ColumnFamilyStore.getTopLevelColumns(ColumnFamilyStore.java:1547)
>         at org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1376)
>         at org.apache.cassandra.db.Keyspace.getRow(Keyspace.java:333)
>         at org.apache.cassandra.db.SliceFromReadCommand.getRow(SliceFromReadCommand.java:65)
>         at org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:1363)
>         at org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:1927)
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:744)
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)