You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Ivo Meißner <in...@overtronic.com> on 2012/06/26 09:07:29 UTC

Secondary index data gone after restart (1.1.1)

Hi,

I am running into some problems with secondary indexes that I am unable to track down. When I restart the cassandra service, the secondary index data won't load and I get the following error during startup: 

INFO 08:29:42,127 Opening /var/myproject/cassandra/data/mykeyspace/group_admin/mykeyspace-group_admin.group_admin_groupId_idx-hd-1 (20808 bytes)
ERROR 08:29:42,159 Exception in thread Thread[SSTableBatchOpen:1,5,main]
java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.nio.ByteBuffer
	at org.apache.cassandra.db.marshal.TimeUUIDType.compare(TimeUUIDType.java:37)
	at org.apache.cassandra.dht.LocalToken.compareTo(LocalToken.java:45)
	at org.apache.cassandra.db.DecoratedKey.compareTo(DecoratedKey.java:89)
	at org.apache.cassandra.db.DecoratedKey.compareTo(DecoratedKey.java:38)
	at java.util.TreeMap.getEntry(TreeMap.java:328)
	at java.util.TreeMap.containsKey(TreeMap.java:209)
	at java.util.TreeSet.contains(TreeSet.java:217)
	at org.apache.cassandra.io.sstable.SSTableReader.load(SSTableReader.java:396)
	at org.apache.cassandra.io.sstable.SSTableReader.open(SSTableReader.java:187)
	at org.apache.cassandra.io.sstable.SSTableReader$1.run(SSTableReader.java:225)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)

When the service starts I can still select data from the column family, but not using the secondary index. 
After I execute "nodetool rebuild_index" the secondary index works fine again until the next restart. 

The error only seems to occur on the column groupId (TimeUUIDType). The other index on userId seems to work. 

I have the following column family definition: 

create column family group_admin with
  comparator = UTF8Type and
  key_validation_class = UTF8Type and
  column_metadata = [
    {column_name: id, validation_class: UTF8Type},
    {column_name: added, validation_class: LongType},
    {column_name: userId, validation_class: BytesType, index_type: KEYS},
    {column_name: requestMessage, validation_class: UTF8Type},
    {column_name: status, validation_class: LongType},
    {column_name: groupId, validation_class: TimeUUIDType, index_type: KEYS}
  ];

Thank you very much for your help!

Ivo

Re: Secondary index data gone after restart (1.1.1)

Posted by aaron morton <aa...@thelastpickle.com>.
CASSANDRA-3954 disabled caches on secondary index CF's in 1.1.0 and  CASSANDRA-4197 enabled it in 1.1.1

Can you create a ticket on https://issues.apache.org/jira/browse/CASSANDRA

I guessing this has something to do with the local partitioner used for the secondary index Cf. That would explain the BigInteger value (from the RP) and the TimeUUIDType could come from the LocalToken. 

Cheers

-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com

On 26/06/2012, at 8:11 PM, Ivo Meißner wrote:

> Hi,
> 
> but if the data must be converted, this is something that should be fixed inside cassandra… Is this a bug, should I file a bug report?
> Or is there some kind of setting I can change to make it work for now?
> 
> Maybe it is related to this issue, but this should have been fixed in 1.1.0:
> 
> https://issues.apache.org/jira/browse/CASSANDRA-3954
> 
> Thanks
> Ivo
> 
> 
> Am 26.06.2012 um 09:26 schrieb Fei Shan:
> 
>> Hi
>> 
>>    please refer JDK nio package's ByteBuffer, I don't think that ByteBuffer can be cast from the BigInteger directly, 
>> it seems you need make some conversion before put it into a ByteBuffer.
>> 
>> Thanks
>> Fei
>> 
>> On Tue, Jun 26, 2012 at 12:07 AM, Ivo Meißner <in...@overtronic.com> wrote:
>> Hi,
>> 
>> I am running into some problems with secondary indexes that I am unable to track down. When I restart the cassandra service, the secondary index data won't load and I get the following error during startup: 
>> 
>> INFO 08:29:42,127 Opening /var/myproject/cassandra/data/mykeyspace/group_admin/mykeyspace-group_admin.group_admin_groupId_idx-hd-1 (20808 bytes)
>> ERROR 08:29:42,159 Exception in thread Thread[SSTableBatchOpen:1,5,main]
>> java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.nio.ByteBuffer
>> 	at org.apache.cassandra.db.marshal.TimeUUIDType.compare(TimeUUIDType.java:37)
>> 	at org.apache.cassandra.dht.LocalToken.compareTo(LocalToken.java:45)
>> 	at org.apache.cassandra.db.DecoratedKey.compareTo(DecoratedKey.java:89)
>> 	at org.apache.cassandra.db.DecoratedKey.compareTo(DecoratedKey.java:38)
>> 	at java.util.TreeMap.getEntry(TreeMap.java:328)
>> 	at java.util.TreeMap.containsKey(TreeMap.java:209)
>> 	at java.util.TreeSet.contains(TreeSet.java:217)
>> 	at org.apache.cassandra.io.sstable.SSTableReader.load(SSTableReader.java:396)
>> 	at org.apache.cassandra.io.sstable.SSTableReader.open(SSTableReader.java:187)
>> 	at org.apache.cassandra.io.sstable.SSTableReader$1.run(SSTableReader.java:225)
>> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>> 	at java.lang.Thread.run(Thread.java:662)
>> 
>> When the service starts I can still select data from the column family, but not using the secondary index. 
>> After I execute "nodetool rebuild_index" the secondary index works fine again until the next restart. 
>> 
>> The error only seems to occur on the column groupId (TimeUUIDType). The other index on userId seems to work. 
>> 
>> I have the following column family definition: 
>> 
>> create column family group_admin with
>>   comparator = UTF8Type and
>>   key_validation_class = UTF8Type and
>>   column_metadata = [
>>     {column_name: id, validation_class: UTF8Type},
>>     {column_name: added, validation_class: LongType},
>>     {column_name: userId, validation_class: BytesType, index_type: KEYS},
>>     {column_name: requestMessage, validation_class: UTF8Type},
>>     {column_name: status, validation_class: LongType},
>>     {column_name: groupId, validation_class: TimeUUIDType, index_type: KEYS}
>>   ];
>> 
>> Thank you very much for your help!
>> 
>> Ivo
>> 
> 
> 


Re: Secondary index data gone after restart (1.1.1)

Posted by Ivo Meißner <in...@overtronic.com>.
Hi,

but if the data must be converted, this is something that should be fixed inside cassandra… Is this a bug, should I file a bug report?
Or is there some kind of setting I can change to make it work for now?

Maybe it is related to this issue, but this should have been fixed in 1.1.0:

https://issues.apache.org/jira/browse/CASSANDRA-3954

Thanks
Ivo


Am 26.06.2012 um 09:26 schrieb Fei Shan:

> Hi
> 
>    please refer JDK nio package's ByteBuffer, I don't think that ByteBuffer can be cast from the BigInteger directly, 
> it seems you need make some conversion before put it into a ByteBuffer.
> 
> Thanks
> Fei
> 
> On Tue, Jun 26, 2012 at 12:07 AM, Ivo Meißner <in...@overtronic.com> wrote:
> Hi,
> 
> I am running into some problems with secondary indexes that I am unable to track down. When I restart the cassandra service, the secondary index data won't load and I get the following error during startup: 
> 
> INFO 08:29:42,127 Opening /var/myproject/cassandra/data/mykeyspace/group_admin/mykeyspace-group_admin.group_admin_groupId_idx-hd-1 (20808 bytes)
> ERROR 08:29:42,159 Exception in thread Thread[SSTableBatchOpen:1,5,main]
> java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.nio.ByteBuffer
> 	at org.apache.cassandra.db.marshal.TimeUUIDType.compare(TimeUUIDType.java:37)
> 	at org.apache.cassandra.dht.LocalToken.compareTo(LocalToken.java:45)
> 	at org.apache.cassandra.db.DecoratedKey.compareTo(DecoratedKey.java:89)
> 	at org.apache.cassandra.db.DecoratedKey.compareTo(DecoratedKey.java:38)
> 	at java.util.TreeMap.getEntry(TreeMap.java:328)
> 	at java.util.TreeMap.containsKey(TreeMap.java:209)
> 	at java.util.TreeSet.contains(TreeSet.java:217)
> 	at org.apache.cassandra.io.sstable.SSTableReader.load(SSTableReader.java:396)
> 	at org.apache.cassandra.io.sstable.SSTableReader.open(SSTableReader.java:187)
> 	at org.apache.cassandra.io.sstable.SSTableReader$1.run(SSTableReader.java:225)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:662)
> 
> When the service starts I can still select data from the column family, but not using the secondary index. 
> After I execute "nodetool rebuild_index" the secondary index works fine again until the next restart. 
> 
> The error only seems to occur on the column groupId (TimeUUIDType). The other index on userId seems to work. 
> 
> I have the following column family definition: 
> 
> create column family group_admin with
>   comparator = UTF8Type and
>   key_validation_class = UTF8Type and
>   column_metadata = [
>     {column_name: id, validation_class: UTF8Type},
>     {column_name: added, validation_class: LongType},
>     {column_name: userId, validation_class: BytesType, index_type: KEYS},
>     {column_name: requestMessage, validation_class: UTF8Type},
>     {column_name: status, validation_class: LongType},
>     {column_name: groupId, validation_class: TimeUUIDType, index_type: KEYS}
>   ];
> 
> Thank you very much for your help!
> 
> Ivo
> 



Re: Secondary index data gone after restart (1.1.1)

Posted by Fei Shan <sh...@gmail.com>.
Hi

   please refer JDK nio package's ByteBuffer, I don't think that ByteBuffer
can be cast from the BigInteger directly,
it seems you need make some conversion before put it into a ByteBuffer.

Thanks
Fei

On Tue, Jun 26, 2012 at 12:07 AM, Ivo Meißner <in...@overtronic.com> wrote:

> Hi,
>
> I am running into some problems with secondary indexes that I am unable to
> track down. When I restart the cassandra service, the secondary index data
> won't load and I get the following error during startup:
>
> INFO 08:29:42,127 Opening
> /var/myproject/cassandra/data/mykeyspace/group_admin/mykeyspace-group_admin.group_admin_groupId_idx-hd-1
> (20808 bytes)
> ERROR 08:29:42,159 Exception in thread Thread[SSTableBatchOpen:1,5,main]
> java.lang.ClassCastException: java.math.BigInteger cannot be cast to
> java.nio.ByteBuffer
> at
> org.apache.cassandra.db.marshal.TimeUUIDType.compare(TimeUUIDType.java:37)
> at org.apache.cassandra.dht.LocalToken.compareTo(LocalToken.java:45)
> at org.apache.cassandra.db.DecoratedKey.compareTo(DecoratedKey.java:89)
> at org.apache.cassandra.db.DecoratedKey.compareTo(DecoratedKey.java:38)
> at java.util.TreeMap.getEntry(TreeMap.java:328)
> at java.util.TreeMap.containsKey(TreeMap.java:209)
> at java.util.TreeSet.contains(TreeSet.java:217)
> at
> org.apache.cassandra.io.sstable.SSTableReader.load(SSTableReader.java:396)
> at
> org.apache.cassandra.io.sstable.SSTableReader.open(SSTableReader.java:187)
> at
> org.apache.cassandra.io.sstable.SSTableReader$1.run(SSTableReader.java:225)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:662)
>
> When the service starts I can still select data from the column family,
> but not using the secondary index.
> After I execute "nodetool rebuild_index" the secondary index works fine
> again until the next restart.
>
> The error only seems to occur on the column groupId (TimeUUIDType). The
> other index on userId seems to work.
>
> I have the following column family definition:
>
> create column family group_admin with
>   comparator = UTF8Type and
>   key_validation_class = UTF8Type and
>   column_metadata = [
>     {column_name: id, validation_class: UTF8Type},
>     {column_name: added, validation_class: LongType},
>     {column_name: userId, validation_class: BytesType, index_type: KEYS},
>     {column_name: requestMessage, validation_class: UTF8Type},
>     {column_name: status, validation_class: LongType},
>     {column_name: groupId, validation_class: TimeUUIDType, index_type:
> KEYS}
>   ];
>
> Thank you very much for your help!
>
> Ivo
>