incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peer, Oded" <Oded.P...@rsa.com>
Subject Problem using sstableloader with SSTableSimpleUnsortedWriter and a composite key
Date Thu, 27 Jun 2013 08:19:55 GMT
Hi,

I am using Cassandra 1.2.5. I built a cluster of 2 data centers with 3 nodes in each data
center.
I created a key space and table with a composite key:
   create keyspace test_keyspace WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1'
: 1, 'DC2' : 1};
   create table test_table ( k1 bigint, k2 bigint, created timestamp, PRIMARY KEY (k1, k2)
) with compaction = { 'class' : 'LeveledCompactionStrategy' };
I then tried to load data to the table using sstableloader, which uses input created via SSTableSimpleUnsortedWriter
using the following code:

   File directory = new File( System.getProperty( "output" ) );
   IPartitioner partitioner = new Murmur3Partitioner();
   String keyspace = "test_keyspace";
   String columnFamily = "test_table";
   List<AbstractType<?>> compositeList = new ArrayList<AbstractType<?>>();
   compositeList.add( LongType.instance );
   compositeList.add( LongType.instance );
   CompositeType compositeType = CompositeType.getInstance( compositeList );
   SSTableSimpleUnsortedWriter sstableWriter = new SSTableSimpleUnsortedWriter(
      directory,
      partitioner,
      keyspace,
      columnFamily,
      compositeType,
      null,
      64 );
   long timestamp = 1372321637000L;
   long nanotimestamp = timestamp * 1000;
   sstableWriter.newRow( compositeType.builder().add( bytes( 1L ) ).add( bytes( 1L ) ).build()
);
   sstableWriter.addColumn( bytes( "created" ), bytes( timestamp ), nanotimestamp );
   sstableWriter.close();
   System.exit( 0 );

I then load the sstable files using the command "sstableloader -d node1 -v -debug test_keyspace/test_table/"
The command ends without any indication of a problem, but the table remains empty.
I see an exception in one of the nodes system.log:
java.lang.RuntimeException: java.lang.IllegalArgumentException
        at org.apache.cassandra.service.RangeSliceVerbHandler.doVerb(RangeSliceVerbHandler.java:64)
        at org.apache.cassandra.net.MessageDeliveryTask.run(MessageDeliveryTask.java:56)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.IllegalArgumentException
        at java.nio.Buffer.limit(Buffer.java:247)
        at org.apache.cassandra.db.marshal.AbstractCompositeType.getBytes(AbstractCompositeType.java:51)
        at org.apache.cassandra.db.marshal.AbstractCompositeType.getWithShortLength(AbstractCompositeType.java:60)
        at org.apache.cassandra.db.marshal.AbstractCompositeType.split(AbstractCompositeType.java:126)
        at org.apache.cassandra.db.filter.ColumnCounter$GroupByPrefix.count(ColumnCounter.java:96)
        at org.apache.cassandra.db.filter.SliceQueryFilter.collectReducedColumns(SliceQueryFilter.java:164)
        at org.apache.cassandra.db.filter.QueryFilter.collateColumns(QueryFilter.java:136)
        at org.apache.cassandra.db.filter.QueryFilter.collateOnDiskAtom(QueryFilter.java:84)
        at org.apache.cassandra.db.RowIteratorFactory$2.getReduced(RowIteratorFactory.java:106)
        at org.apache.cassandra.db.RowIteratorFactory$2.getReduced(RowIteratorFactory.java:79)
        at org.apache.cassandra.utils.MergeIterator$ManyToOne.consume(MergeIterator.java:114)
        at org.apache.cassandra.utils.MergeIterator$ManyToOne.computeNext(MergeIterator.java:97)
        at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
        at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
        at org.apache.cassandra.db.ColumnFamilyStore$3.computeNext(ColumnFamilyStore.java:1399)
        at org.apache.cassandra.db.ColumnFamilyStore$3.computeNext(ColumnFamilyStore.java:1395)
        at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
        at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
        at org.apache.cassandra.db.ColumnFamilyStore.filter(ColumnFamilyStore.java:1466)
        at org.apache.cassandra.db.ColumnFamilyStore.getRangeSlice(ColumnFamilyStore.java:1443)
        at org.apache.cassandra.service.RangeSliceVerbHandler.executeLocally(RangeSliceVerbHandler.java:46)
        at org.apache.cassandra.service.RangeSliceVerbHandler.doVerb(RangeSliceVerbHandler.java:58)
        ... 4 more

Am I using the CompositeType and SSTableSimpleUnsortedWriter correctly?

Mime
View raw message