cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gavin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-6612) Query failing due to AssertionError
Date Fri, 31 Jan 2014 14:08:09 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-6612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13887773#comment-13887773
] 

Gavin commented on CASSANDRA-6612:
----------------------------------

There seem to be some issues with indexing on fields that are part of your primary key (see
also https://issues.apache.org/jira/browse/CASSANDRA-6470).  You may want to try revising
your schema and/or query to remove the need to index key columns.

I was also able to reproduce this error in cassandra 2.0.1 and 2.0.4 using cqlsh or the java
driver (I tried two versions of the 2.0.0rc, reproduction code below).

public static void main(String[] args) {
	com.datastax.driver.core.Session session = null;
	try {
		String address = "localhost";
		session = new com.datastax.driver.core.Cluster.Builder().addContactPoint(address).build().connect();
		//create keyspace, table, and indices
		session.execute("create keyspace if not exists testing  with replication = { 'class':'SimpleStrategy',
'replication_factor':1 }");
		session.execute("drop table if exists testing.timerangetest");
		//creating the table using "i_end" as a partition key reproduces https://issues.apache.org/jira/browse/CASSANDRA-6612
		session.execute("create table if not exists testing.timerangetest (id text, end timestamp,
i_eq_dummy blob, i_start timestamp, i_end timestamp, primary key ((id, end)))");
		//creating the table using "i_end" as a cluster key reproduces https://issues.apache.org/jira/browse/CASSANDRA-6470
		//session.execute("create table if not exists testing.timerangetest (id text, i_eq_dummy
blob, i_start timestamp, i_end timestamp, primary key (id, i_end))");

		session.execute("create index if not exists on testing.timerangetest (i_start)");
		session.execute("create index if not exists on testing.timerangetest (i_end)");
		session.execute("create index if not exists on testing.timerangetest (i_eq_dummy)");
		//insert some values
		session.execute("insert into testing.timerangetest (id, end, i_eq_dummy, i_start, i_end)
values ('row1', 5, 0x00, 1, 5)");
		session.execute("insert into testing.timerangetest (id, end, i_eq_dummy, i_start, i_end)
values ('row2', 13, 0x00, 3, 13)");
		session.execute("insert into testing.timerangetest (id, end, i_eq_dummy, i_start, i_end)
values ('row3', 17, 0x00, 12, 17)");
		session.execute("insert into testing.timerangetest (id, end, i_eq_dummy, i_start, i_end)
values ('row4', 22, 0x00, 16, 22)");
		session.execute("insert into testing.timerangetest (id, end, i_eq_dummy, i_start, i_end)
values ('row5', 24, 0x00, 21, 24)");
		session.execute("insert into testing.timerangetest (id, end, i_eq_dummy, i_start, i_end)
values ('row6', 23, 0x00, 4, 23)");
		//query for everything
		System.out.println("all records:");
		for (com.datastax.driver.core.Row r : session.execute("select * from testing.timerangetest").all())
{
			System.out.println("  " + r.getString("id") + " @ " + r.getDate("i_start").getTime() +
"-" + r.getDate("i_end").getTime());
		}
		//query for records that were active between 10 and 20
		System.out.println("active records from 10-20:");
		for (com.datastax.driver.core.Row r : session.execute("select * from testing.timerangetest
where i_eq_dummy=0x00 and i_end >= 10 and i_start <= 20 allow filtering").all()) {
			System.out.println("  " + r.getString("id") + " @ " + r.getDate("i_start").getTime() +
"-" + r.getDate("i_end").getTime());
		}
		//query for records that were active between 10 and 20 where id='row2'
		System.out.println("active records from 10-20 where id='row2' and end=13:");
		for (com.datastax.driver.core.Row r : session.execute("select * from testing.timerangetest
where id='row2' and end=13 and i_eq_dummy=0x00 and i_end >= 10 and i_start <= 20 allow
filtering").all()) {
			System.out.println("  " + r.getString("id") + " @ " + r.getDate("i_start").getTime() +
"-" + r.getDate("i_end").getTime());
		}
	} finally {
		if (session != null) {
			com.datastax.driver.core.Cluster c = session.getCluster();
			session.close();
			c.close();
		}
	}
}

> Query failing due to AssertionError
> -----------------------------------
>
>                 Key: CASSANDRA-6612
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-6612
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: Cassandra-2.0.4, CQL3, datastax driver 2.0.0-rc2
>            Reporter: A Verma
>
> 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:
> {code}
> select count(*) from session_data where app_name=? and account=? and last_access >
?
> {code}
> But after even a single row is inserted into the table, the query fails with the following
error:
> {code}
>     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)
> {code}
> Here is the schema I am using:
> {code}
>     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);
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message