incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Florian <bflor...@gmail.com>
Subject Deleting and re-inserting row causes error in get_slice count parameter
Date Mon, 22 Mar 2010 22:13:40 GMT
I'm new to Cassandra and have run into a problem that I think is a
bug, but wanted to get some feedback in case I'm misunderstanding
something.

I've found that when I delete an entire row in a column family with
super columns, and then re-insert values with the same row and super
column keys, the count parameter to the get_slice call no longer works
properly.  Its like it is still counting the deleted columns, but only
returning the new columns.

The following example uses the Ruby Cassandra client (see link below),
but I've seen the same behavior with the Java Thrift interface.

1)  First I create a client and insert a super column with three columns:

>> require 'cassandra'
=> true
>> cc = Cassandra.new('Keyspace1')
=> #<Cassandra:2159536540, @keyspace="Keyspace1", @schema={},
@servers=["127.0.0.1:9160"]>
>> cc.insert(:Super1,'test1',{'bucket1' => {'1' => 'Item 1', '2' => 'Item 2',
'5' => 'Item 5'}})
=> nil


2)  Getting the slice of columns just inserted works with or without
the count parameter:

>> cc.get(:Super1,'test1','bucket1')
=> #<OrderedHash {"1"=>"Item 1", "2"=>"Item 2", "5"=>"Item 5"}>

>> cc.get(:Super1,'test1','bucket1',:count => 3)
=> #<OrderedHash {"1"=>"Item 1", "2"=>"Item 2", "5"=>"Item 5"}>


3)  Now I remove the row:

>> cc.remove(:Super1,'test1')
=> nil


4)  And confirm that nothing's left:
>> cc.get(:Super1,'test1','bucket1')
=> #<OrderedHash {}>


5)  Next I insert 3 different columns using the same row and super column keys:

>> cc.insert(:Super1,'test1',{'bucket1' => {'3' => 'Item 3', '4' => 'Item 4',
'6' => 'Item 6'}})
=> nil


6)  Getting the slice of columns works correctly with no count parameter:

>> cc.get(:Super1,'test1','bucket1')
=> #<OrderedHash {"6"=>"Item 6", "3"=>"Item 3", "4"=>"Item 4"}>


7)  But setting the count parameter to 3 returns fewer than 3 columns:

>> cc.get(:Super1,'test1','bucket1',:count => 3)
=> #<OrderedHash {"3"=>"Item 3"}>


8)  Incrementally increasing the count parameter confirms the apparent
behavior of counting the deleted columns:

>> cc.get(:Super1,'test1','bucket1',:count => 4)
=> #<OrderedHash {"3"=>"Item 3", "4"=>"Item 4"}>
>> cc.get(:Super1,'test1','bucket1',:count => 5)
=> #<OrderedHash {"3"=>"Item 3", "4"=>"Item 4"}>


9) I have to set the count to 6 to return all 3 columns:

>> cc.get(:Super1,'test1','bucket1',:count => 6)
=> #<OrderedHash {"6"=>"Item 6", "3"=>"Item 3", "4"=>"Item 4"}>


The same thing doesn't happen when I remove only the super column key
('bucket1').

Here's the reference to the Ruby client I used for the example, but
the problem is not client specific.
http://blog.evanweaver.com/files/doc/fauna/cassandra/files/README_rdoc.html

Mime
View raw message