cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <jbel...@gmail.com>
Subject Re: Remove not working for me
Date Fri, 09 Oct 2009 00:41:09 GMT
"Internal error" usually means you found a bug.  Are there any
exceptions in the server log?

On Thu, Oct 8, 2009 at 7:33 PM, Ramzi Rabah <rrabah@playdom.com> wrote:
> Hello all,
>
> I am trying to test Cassandra for deploying it in production in our
> company, and I am very pleased with the performance of the
> reads/writes on Columns. I did run into an issue with the API though
> while trying to play with supercolumns. Here is my code:
>
> // Creating a supercolumn with name = "key" and columns ("value", "created").
>        long now = System.currentTimeMillis();
>        byte[] keyAsBytes = key.getBytes();
>
>        ColumnOrSuperColumn colOrSuperCol = new ColumnOrSuperColumn();
>        SuperColumn superCol = new SuperColumn();
>        colOrSuperCol.setSuper_column(superCol);
>        superCol.setName(keyAsBytes);
>        List<Column> cols = new ArrayList<Column>();
>
>        // first the key/value pair
>        Column col = new Column();
>        col.setName("value".getBytes());
>        col.setValue(value);
>        cols.add(col);
>
>        // then the time created
>        col = new Column();
>        col.setName("created".getBytes());
>        col.setValue((now + "").getBytes());
>        cols.add(col);
>
>        superCol.setColumns(cols);
>
>        Map<String, List<ColumnOrSuperColumn>> map = new
> HashMap<String, List<ColumnOrSuperColumn>>();
>        List<ColumnOrSuperColumn> list = new ArrayList<ColumnOrSuperColumn>();
>        list.add(colOrSuperCol);
>        map.put(COLUMN_FAMILY_NAME, list);
>
>        client.batch_insert(KEYSPACE_NAME, key, map, ConsistencyLevel.ONE);
>
>
> // The GET of the supercolumn
>        SlicePredicate predicate = new SlicePredicate(null, new
> SliceRange(new byte
> [0], new byte[0], false, 2));
>        ColumnParent parent = new ColumnParent(COLUMN_FAMILY_NAME,
> key.getBytes());
>
>        List<ColumnOrSuperColumn> columns = null;
>            columns = client.get_slice(KEYSPACE_NAME, key,
>                    parent, predicate, ConsistencyLevel.ONE);
>
>
> // delete the supercolumn
>            client.remove(KEYSPACE_NAME, key,new
> ColumnPath(COLUMN_FAMILY_NAME, null, null),
> System.currentTimeMillis(),ConsistencyLevel.ONE);
>
> // Do the get again
>
> When I try to delete the super column and then I try to read it again,
> I get an exception thrown by cassandra
>
> org.apache.thrift.TApplicationException: Internal error processing get_slice
>        at org.apache.thrift.TApplicationException.read(TApplicationException.java:107)
>        at org.apache.cassandra.service.Cassandra$Client.recv_get_slice(Cassandra.java:171)
>        at org.apache.cassandra.service.Cassandra$Client.get_slice(Cassandra.java:150)
>        at com.playdom.cassandra.datastore.CassandraDataStore.testGet(CassandraDataStore.java:233)
>        at com.playdom.cassandra.test.TestCassandraDataStore.testSetAndGetTrial(TestCassandraDataStore.java:58)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at junit.framework.TestCase.runTest(TestCase.java:168)
>        at junit.framework.TestCase.runBare(TestCase.java:134)
>        at junit.framework.TestResult$1.protect(TestResult.java:110)
>        at junit.framework.TestResult.runProtected(TestResult.java:128)
>        at junit.framework.TestResult.run(TestResult.java:113)
>        at junit.framework.TestCase.run(TestCase.java:124)
>        at junit.framework.TestSuite.runTest(TestSuite.java:232)
>        at junit.framework.TestSuite.run(TestSuite.java:227)
>        at junit.textui.TestRunner.doRun(TestRunner.java:116)
>        at com.intellij.rt.execution.junit.IdeaTestRunner.doRun(IdeaTestRunner.java:94)
>        at junit.textui.TestRunner.doRun(TestRunner.java:109)
>        at com.intellij.rt.execution.junit.IdeaTestRunner.startRunnerWithArgs(IdeaTestRunner.java:22)
>        at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:118)
>        at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
>
> I was expecting a NotFoundException() since I thought the read will
> not find anything. Also anytime I try to rerun this after the delete I
> always get an exception in the reads.
>
> Am I doing something seriously wrong? Thanks a lot for your help
>
> Ray
>

Mime
View raw message