由于AssertionError,Cassandra计数查询失败

时间:2014-01-22 19:18:54

标签: cassandra

我第一次尝试Cassandra并在本地运行它以进行简单的会话管理db。 [Cassandra-2.0.4,CQL3,datastax driver 2.0.0-rc2]

当表中没有数据时,以下计数查询正常工作:

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

但即使在表中插入一行,查询也会失败,并显示以下错误:

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)

这是我正在使用的架构:

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);

我想知道表定义/索引或查询本身是否有问题。任何帮助/见解将不胜感激。

1 个答案:

答案 0 :(得分:2)

看起来你正在绊倒Cassandra的一个错误。以下是Cassandra来源中的断言和相关评论:

/*
 * 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);

此代码在 cassandra-2.0.4 trunk 之间进行了修改,作为故障CASSANDRA-5417的一部分,但我不清楚作者是否知道这个问题。断言被删除,但评论没有。我建议向Cassandra项目提交错误报告。