averma
averma

Reputation: 13

Cassandra count query failing due to AssertionError

I am trying out Cassandra for the first time and running it locally for simple session management db. [Cassandra-2.0.4, CQL3, datastax driver 2.0.0-rc2]

The following count query works fine when there is no data in the table:

select count(*) from session_data where app_name=? and account=? and last_access > ?

But after even a single row is inserted into the table, the query fails with the following error:

java.lang.AssertionError
at org.apache.cassandra.db.filter.ExtendedFilter$WithClauses.getExtraFilter(ExtendedFilter.java:258)
at org.apache.cassandra.db.ColumnFamilyStore.filter(ColumnFamilyStore.java:1719)
at org.apache.cassandra.db.ColumnFamilyStore.getRangeSlice(ColumnFamilyStore.java:1674)
at org.apache.cassandra.db.PagedRangeCommand.executeLocally(PagedRangeCommand.java:111)
at org.apache.cassandra.service.StorageProxy$LocalRangeSliceRunnable.runMayThrow(StorageProxy.java:1418)
at org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:1931)
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)

Here is the schema I am using:

CREATE KEYSPACE session WITH replication= {'class': 'SimpleStrategy', 'replication_factor': 1};

CREATE TABLE session_data (
username text,
session_id text,
app_name text,
account text,
last_access timestamp,
created_on timestamp,
PRIMARY KEY (username, session_id, app_name, account)
);

create index sessionIndex ON session_data (session_id);
create index sessionAppName ON session_data (app_name);
create index lastAccessIndex ON session_data (last_access);

I am wondering if there is something wrong in the table definition/indexes or the query itself. Any help/insight would be greatly appreciated.

Upvotes: 1

Views: 618

Answers (1)

Andy S
Andy S

Reputation: 404

It looks like you're tripping over a bug in Cassandra. Here is the assertion and related comments in the Cassandra sources:

/*
 * This method assumes the IndexExpression names are valid column names, which is not the
 * case with composites. This is ok for now however since:
 * 1) CompositeSearcher doesn't use it.
 * 2) We don't yet allow non-indexed range slice with filters in CQL3 (i.e. this will never be
 * called by CFS.filter() for composites).
 */
assert !(cfs.getComparator() instanceof CompositeType);

This code was modified between cassandra-2.0.4 and trunk as part of ticket CASSANDRA-5417, but it's not clear to me that the author was aware of this issue. The assertion was removed, but the comment was not. I would recommend submitting a bug report to the Cassandra project.

Upvotes: 2

Related Questions