Use this as your timestamp int(time.time() * 1e6)
On 10 Nov, 2010,at 08:59 AM, Rajat Chopra <rcho...@makara.com> wrote:
Requesting the forum’s kind attention to consistency failures that I notice
Cassandra version - 0.6.4
Thrift version – 0.4.0
Driving Language – Python
Machine – 4 core, 8G, Fedora 13, i686
storage_conf.xml - default
I took the example from ->
http://wiki.apache.org/cassandra/ThriftExamples#Python
And changed it little bit to do multiple inserts with different values on the same column :
try:
transport.open()
#Insert the data into Keyspace 1
value1 = "foob...@example.com"
value2 = "foob...@example.com"
for x in range(3):
client.insert(keyspace, key, column_path, value1, time.time(), ConsistencyLevel.ALL)
result1 = client.get_slice(keyspace, key, column_parent, predicate, ConsistencyLevel.ALL)
client.insert(keyspace, key, column_path, value2, time.time(), ConsistencyLevel.ALL)
result2 = client.get_slice(keyspace, key, column_parent, predicate, ConsistencyLevel.ALL)
pp.pprint(result1)
pp.pprint(result2)
And the output I see is :
[ ColumnOrSuperColumn(column=Column(timestamp=1289332871, name='email', value='foob...@example.com'), super_column=None)]
[ ColumnOrSuperColumn(column=Column(timestamp=1289332871, name='email', value='foob...@example.com'), super_column=None)]
[ ColumnOrSuperColumn(column=Column(timestamp=1289332871, name='email', value='foob...@example.com'), super_column=None)]
[ ColumnOrSuperColumn(column=Column(timestamp=1289332871, name='email', value='foob...@example.com'), super_column=None)]
[ ColumnOrSuperColumn(column=Column(timestamp=1289332871, name='email', value='foob...@example.com'), super_column=None)]
[ ColumnOrSuperColumn(column=Column(timestamp=1289332871, name='email', value='foob...@example.com'), super_column=None)]
Should I not get ‘foobar1, foobar2, foobar1, foobar2, foobar1, foobar2’, especially when I give ConsistencyLevel.ALL (silly though it’s a single node cluster)?
My first guess with what is going wrong is timestamp, which then brings the question of timestamp resolution. Nevertheless, why do I see foobar1/foobar2 in the first iteration?
Is the issue 876, related to this? ( https://issues.apache.org/jira/browse/CASSANDRA-876 )
If this is expected behavior, can anyone suggest a workaround for my piece of code that expects quick updates to the same column?
I would appreciate any help/insight into the matter
Sincere thanks,
Rajat