Regarding deleting an entire row using hector

32 views
Skip to first unread message

ck

unread,
Sep 23, 2010, 3:24:38 PM9/23/10
to hector-users
Hi All

I am having trouble deleting the entire row from a CF using hector,
since its asking for columnName as part of the query argument. I am
running 0.6.5 version of cassandra and the hector-0.6.0-15.zip version
of hector. I read in another post that the row deletion problem has
been fixed in the latest (hector-0.7.0-16.zip) version of hector...My
question is can I use the latest version of hector to query cassandra
0.6.5 ? I am NOT in a position to upgrade to the 0.7-beta version of
cassandra.... Please suggest...


Thanks
CK

ck

unread,
Sep 23, 2010, 3:53:43 PM9/23/10
to hector-users
I am guessing we cannot use the trunk version , since I am running
into thrift related exceptions...
eg:
java.lang.NoClassDefFoundError: org/apache/cassandra/thrift/Clock
at
me.prettyprint.cassandra.service.ClockResolution.createClock(ClockResolution.java:
20)
at me.prettyprint.cassandra.model.HFactory.createClock(HFactory.java:
216)
at me.prettyprint.cassandra.model.HFactory.createColumn(HFactory.java:
200)
at
pitt.search.datastore.cassandra.CassandraVectorStore.put(CassandraVectorStore.java:
114)
at
pitt.search.datastore.cassandra.CassandraVectorStoreTest.testPutGetDeleteVector(CassandraVectorStoreTest.java:
72)
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.extensions.TestDecorator.basicRun(TestDecorator.java:24)
at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.extensions.TestSetup.run(TestSetup.java:27)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:
91)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:
46)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:
38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
197)
Caused by: java.lang.ClassNotFoundException:
org.apache.cassandra.thrift.Clock
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 28 more

Please let me know if there is a workaround

Nate McCall

unread,
Sep 23, 2010, 4:36:42 PM9/23/10
to hector...@googlegroups.com
No, the 0.6.0-15 version is only usable with Cassandra 0.6.*

Do you have a specific example you could show? Generally, the design
is that you can send a null or empty string for column name and it
will trigger a delete of the entire row.

ck

unread,
Sep 23, 2010, 7:24:12 PM9/23/10
to hector-users
Thanks for the reply.... Here is what I get when i call delete() with
"empty string" and null for the columnname argument in hector

public void remove(Object key) {
String keyStr = (String) key;
Mutator m = HFactory.createMutator(m_ko);

MutationResult mr2 = m.delete(keyStr, m_cf,"", se); //
columnName is empty string
}
me.prettyprint.cassandra.model.InvalidRequestException:
InvalidRequestException(why:column name must not be empty)
at
me.prettyprint.cassandra.service.ExceptionsTranslatorImpl.translate(ExceptionsTranslatorImpl.java:
28)
at me.prettyprint.cassandra.service.KeyspaceImpl
$2.execute(KeyspaceImpl.java:125)
at me.prettyprint.cassandra.service.KeyspaceImpl
$2.execute(KeyspaceImpl.java:119)
at
me.prettyprint.cassandra.service.Operation.executeAndSetResult(FailoverOperator.java:
351)
at
me.prettyprint.cassandra.service.FailoverOperator.operateSingleIteration(FailoverOperator.java:
170)
at
me.prettyprint.cassandra.service.FailoverOperator.operate(FailoverOperator.java:
83)
at
me.prettyprint.cassandra.service.KeyspaceImpl.operateWithFailover(KeyspaceImpl.java:
157)
at
me.prettyprint.cassandra.service.KeyspaceImpl.batchMutate(KeyspaceImpl.java:
130)
at
me.prettyprint.cassandra.service.KeyspaceImpl.batchMutate(KeyspaceImpl.java:
135)
at me.prettyprint.cassandra.model.Mutator$2.doInKeyspace(Mutator.java:
106)
at me.prettyprint.cassandra.model.Mutator$2.doInKeyspace(Mutator.java:
103)
at
me.prettyprint.cassandra.model.KeyspaceOperationCallback.doInKeyspaceAndMeasure(KeyspaceOperationCallback.java:
12)
at
me.prettyprint.cassandra.model.KeyspaceOperator.doExecute(KeyspaceOperator.java:
47)
at me.prettyprint.cassandra.model.Mutator.execute(Mutator.java:103)
at me.prettyprint.cassandra.model.Mutator.delete(Mutator.java:52)
at
pitt.search.datastore.cassandra.CassandraVectorStore.remove(CassandraVectorStore.java:
119)
at
pitt.search.datastore.cassandra.CassandraVectorStoreTest.testPutGetDeleteVector(CassandraVectorStoreTest.java:
83)
Caused by: InvalidRequestException(why:column name must not be empty)
at org.apache.cassandra.thrift.Cassandra
$batch_mutate_result.read(Cassandra.java:15424)
at org.apache.cassandra.thrift.Cassandra
$Client.recv_batch_mutate(Cassandra.java:801)
at org.apache.cassandra.thrift.Cassandra
$Client.batch_mutate(Cassandra.java:777)
at me.prettyprint.cassandra.service.KeyspaceImpl
$2.execute(KeyspaceImpl.java:123)
... 38 more





public void remove(Object key) {
String keyStr = (String) key;
Mutator m = HFactory.createMutator(m_ko);

MutationResult mr2 = m.delete(keyStr, m_cf,null, se); //
columnName is null
}

me.prettyprint.cassandra.model.HectorException:
me.prettyprint.cassandra.model.HectorException:
java.lang.NullPointerException
at
me.prettyprint.cassandra.service.FailoverOperator.operate(FailoverOperator.java:
133)
at
me.prettyprint.cassandra.service.KeyspaceImpl.operateWithFailover(KeyspaceImpl.java:
157)
at
me.prettyprint.cassandra.service.KeyspaceImpl.batchMutate(KeyspaceImpl.java:
130)
at
me.prettyprint.cassandra.service.KeyspaceImpl.batchMutate(KeyspaceImpl.java:
135)
at me.prettyprint.cassandra.model.Mutator$2.doInKeyspace(Mutator.java:
106)
at me.prettyprint.cassandra.model.Mutator$2.doInKeyspace(Mutator.java:
103)
at
me.prettyprint.cassandra.model.KeyspaceOperationCallback.doInKeyspaceAndMeasure(KeyspaceOperationCallback.java:
12)
at
me.prettyprint.cassandra.model.KeyspaceOperator.doExecute(KeyspaceOperator.java:
47)
at me.prettyprint.cassandra.model.Mutator.execute(Mutator.java:103)
at me.prettyprint.cassandra.model.Mutator.delete(Mutator.java:52)
at
pitt.search.datastore.cassandra.CassandraVectorStore.remove(CassandraVectorStore.java:
119)
at
pitt.search.datastore.cassandra.CassandraVectorStoreTest.testPutGetDeleteVector(CassandraVectorStoreTest.java:
83)
Caused by: me.prettyprint.cassandra.model.HectorException:
java.lang.NullPointerException
at
me.prettyprint.cassandra.service.ExceptionsTranslatorImpl.translate(ExceptionsTranslatorImpl.java:
42)
at me.prettyprint.cassandra.service.KeyspaceImpl
$2.execute(KeyspaceImpl.java:125)
at me.prettyprint.cassandra.service.KeyspaceImpl
$2.execute(KeyspaceImpl.java:119)
at
me.prettyprint.cassandra.service.Operation.executeAndSetResult(FailoverOperator.java:
351)
at
me.prettyprint.cassandra.service.FailoverOperator.operateSingleIteration(FailoverOperator.java:
170)
at
me.prettyprint.cassandra.service.FailoverOperator.operate(FailoverOperator.java:
83)
... 34 more
Caused by: java.lang.NullPointerException
at
org.apache.thrift.protocol.TBinaryProtocol.writeBinary(TBinaryProtocol.java:
183)
at
org.apache.cassandra.thrift.SlicePredicate.write(SlicePredicate.java:
412)
at org.apache.cassandra.thrift.Deletion.write(Deletion.java:458)
at org.apache.cassandra.thrift.Mutation.write(Mutation.java:377)
at org.apache.cassandra.thrift.Cassandra
$batch_mutate_args.write(Cassandra.java:14996)
at org.apache.cassandra.thrift.Cassandra
$Client.send_batch_mutate(Cassandra.java:787)
at org.apache.cassandra.thrift.Cassandra
$Client.batch_mutate(Cassandra.java:776)
at me.prettyprint.cassandra.service.KeyspaceImpl
$2.execute(KeyspaceImpl.java:123)
... 38 more


Let me know if I am not using the api right...

Thanks
CK

Nate McCall

unread,
Sep 24, 2010, 12:27:56 AM9/24/10
to hector...@googlegroups.com
Apologies this fix was done in trunk for the master branch (as well as
0.7.0) on hector recently. We should be doing a release shortly.

ck

unread,
Sep 27, 2010, 8:55:22 PM9/27/10
to hector-users
Hi Nate,

Thanks for the reply. Any rough idea on the timelines regarding the
next 0.6.x release

CK
> ...
>
> read more »

Nate McCall

unread,
Sep 28, 2010, 1:05:56 AM9/28/10
to hector...@googlegroups.com

ck

unread,
Oct 3, 2010, 5:54:16 PM10/3/10
to hector-users
Thanks for the update....I am still running into the same issues with
the latest version (hector-0.6.0-17.zip)... I get the following
exception if I pass a empty string to the columnName argument when I
delete a key and get a NullPointerException if I pass a null for the
columnName... Am I using the right version ? Please let me know.

Thanks
CK

me.prettyprint.hector.api.exceptions.HInvalidRequestException:
InvalidRequestException(why:column name must not be empty)
at
me.prettyprint.cassandra.service.ExceptionsTranslatorImpl.translate(ExceptionsTranslatorImpl.java:
28)
at me.prettyprint.cassandra.service.KeyspaceServiceImpl
$2.execute(KeyspaceServiceImpl.java:119)
at me.prettyprint.cassandra.service.KeyspaceServiceImpl
$2.execute(KeyspaceServiceImpl.java:113)
at
me.prettyprint.cassandra.service.Operation.executeAndSetResult(FailoverOperator.java:
384)
at
me.prettyprint.cassandra.service.FailoverOperator.operateSingleIteration(FailoverOperator.java:
190)
at
me.prettyprint.cassandra.service.FailoverOperator.operate(FailoverOperator.java:
99)
at
me.prettyprint.cassandra.service.KeyspaceServiceImpl.operateWithFailover(KeyspaceServiceImpl.java:
151)
at
me.prettyprint.cassandra.service.KeyspaceServiceImpl.batchMutate(KeyspaceServiceImpl.java:
124)
at
me.prettyprint.cassandra.service.KeyspaceServiceImpl.batchMutate(KeyspaceServiceImpl.java:
129)
at me.prettyprint.cassandra.model.MutatorImpl
$2.doInKeyspace(MutatorImpl.java:127)
at me.prettyprint.cassandra.model.MutatorImpl
$2.doInKeyspace(MutatorImpl.java:124)
at
me.prettyprint.cassandra.model.KeyspaceOperationCallback.doInKeyspaceAndMeasure(KeyspaceOperationCallback.java:
20)
at
me.prettyprint.cassandra.model.ExecutingKeyspace.doExecute(ExecutingKeyspace.java:
58)
at
me.prettyprint.cassandra.model.MutatorImpl.execute(MutatorImpl.java:
124)
at me.prettyprint.cassandra.model.MutatorImpl.delete(MutatorImpl.java:
61)
at
pitt.search.datastore.cassandra.CassandraVectorStore.remove(CassandraVectorStore.java:
135)
at
pitt.search.datastore.cassandra.CassandraVectorStoreTest.testPutGetDeleteVector(CassandraVectorStoreTest.java:
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
197)
Caused by: InvalidRequestException(why:column name must not be empty)
at org.apache.cassandra.thrift.Cassandra
$batch_mutate_result.read(Cassandra.java:15424)
at org.apache.cassandra.thrift.Cassandra
$Client.recv_batch_mutate(Cassandra.java:801)
at org.apache.cassandra.thrift.Cassandra
$Client.batch_mutate(Cassandra.java:777)
at me.prettyprint.cassandra.service.KeyspaceServiceImpl
$2.execute(KeyspaceServiceImpl.java:117)
... 38 more



On Sep 27, 10:05 pm, Nate McCall <n...@riptano.com> wrote:
> About 10 mins ago :-)
>
> http://github.com/rantav/hector/downloads
>
> On Mon, Sep 27, 2010 at 7:55 PM,ck<ckanna...@gmail.com> wrote:
> > Hi Nate,
>
> > Thanks for the reply. Any rough idea on the timelines regarding the
> > next 0.6.x release
>
> >CK
>
> > On Sep 23, 9:27 pm, Nate McCall <n...@riptano.com> wrote:
> >> Apologies this fix was done in trunk for the master branch (as well as
> >> 0.7.0) on hector recently. We should be doing a release shortly.
>
> ...
>
> read more »

ck

unread,
Oct 3, 2010, 6:23:37 PM10/3/10
to hector-users
Looks like passing "null" for the columnName field does take care of
marking the entire row as deleted (tombstones)... Once again, thanks
for the update...Gr8 work !!!

CK
> ...
>
> read more »

Nate McCall

unread,
Oct 3, 2010, 9:32:28 PM10/3/10
to hector...@googlegroups.com
Thanks! I'm glad that worked out.
Reply all
Reply to author
Forward
0 new messages