Delete a complete row

3 views
Skip to first unread message

Michael Duergner

unread,
Jun 26, 2010, 4:31:11 PM6/26/10
to jassand...@googlegroups.com
Hi there,

is there a way to delete a complete row? As I understand Cassandra Thrift interface it should be possible when setting the ColumnPath to just the ColumnFamily but Jassandra's implementation of delete on ColumnFamily expects the IColumn parameter to not be null, or?

regards
Michael

Dop Sun

unread,
Jun 26, 2010, 5:57:40 PM6/26/10
to jassand...@googlegroups.com
As for deletion, jassandra using batch_mutate at the moment (till 0.6.x).

Aware of that there is a Remove API, Will add this feature into the next build of Jassandra.

Dop Sun

unread,
Jun 26, 2010, 6:59:05 PM6/26/10
to jassand...@googlegroups.com
Issue 27 raised. As detailed there, the Remove API may leave empty Keys behind. I'm checking with Cassandra user group now. Will commit the changes once the behavior is confirmed.

Please feel free to add your comments to the Issue.

caribbean

unread,
Jul 13, 2010, 2:55:59 PM7/13/10
to jassandra-user
I am interested in the same issue in this thread. The delete in
cassandra.

Even if we can delete a column by cf.delete or criteria.delete, the
strange thing is the database size is not changed, looks like no
delete is performed at all.

What I want to do is, if I use the key iterations to get all keys and
delete the corresponding columns, then the database will be empty. But
in fact the size of database never changes.

Another observation: suppose I already created a database, then I stop
cassandra server and delete all files under Keyspace1. Then I start
cassandra server again, it will automatically generate some database
files. Then if I stop the server again and delete all newly generated
files, then start server again, the files are finally gone: no more
new files are generated. I know this is the problem of cassandra not
client, but the behavior is really strange.

Dop Sun

unread,
Jul 14, 2010, 8:11:42 AM7/14/10
to jassandra-user
For the first one, it's because the Cassandra is Eventually
Consistency, so, when you try to delete a row from a single node, it
just marked it as deleted, and populate this information to all other
nodes if necessary.

That's why the database size does not change at all, and why the query
will return the deleted column with null values.

For the second one, it's because you only delete the details in the
data folder, but actually what Cassandra does is: all updating, will
first be written into the commit log (in commitlog folder), and return
to the client. And commit log will be updated to data file
periodically, or the Cassandra restarted.

In your scenario, when you delete the data file only, and restart
Cassandra, the information in the commit log will be flushed to the
data file, that why you saw the data file created again. And second
time you delete, and restart, since there are no un-flushed commit
log, then nothing created.

Dop

caribbean

unread,
Jul 14, 2010, 5:42:15 PM7/14/10
to jassandra-user
I see the second problem now. So if I also delete the commit log file,
it should not flush any data to data file any more.

For the first problem, right now I am running cassandra on single
server, it is possible that if I want to delete a column, it can
actually delete it from databse rather than just marking it as
deleted? Thanks,

Dop Sun

unread,
Jul 14, 2010, 11:48:58 PM7/14/10
to jassandra-user
I believe it's always marked as deleted first (marked as tombstone).

And these tombstone will be removed automatically depends on when the
compaction happens.

Refer http://wiki.apache.org/cassandra/DistributedDeletes for more
details.
Reply all
Reply to author
Forward
0 new messages