cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jiang Chen <jia...@gmail.com>
Subject Updates lost
Date Mon, 29 Aug 2011 21:03:14 GMT
Hi,

Just started developing using Cassandra (0.8.4). I noticed when
updating the same row and column repeatedly, say, in a test case,
updates may get lost. I found it in a Java client but the following
python script also exhibits the same problem.

******************************************************************
import pycassa
import time

pool = pycassa.ConnectionPool('TestKeySpace', server_list=['localhost'])

cf = pycassa.ColumnFamily(pool, 'blah')

for i in range(1, 1000):
	cf.insert('foo', {'body': 'aaa'})
	assert 'aaa'==cf.get('foo')['body']	
	cf.insert('foo', {'body': 'bbb'})
	assert 'bbb'==cf.get('foo')['body']
	#time.sleep(0.015)

	print i
******************************************************************

The script errors out at assertion, when the value is supposed to be
updated back to 'aaa' from 'bbb'

******************************************************************
$ python test.py
1
Traceback (most recent call last):
  File "test.py", line 10, in <module>
    assert 'aaa'==cf.get('foo')['body']
AssertionError
******************************************************************

If the client sleeps for a few ms at each loop, the success rate
increases. At 15 ms, the script always succeeds so far. Interestingly,
the problem seems to be sensitive to alphabetical order. Updating the
value from 'aaa' to 'bbb' never has problem. No pause needed.

Is this a real problem or I'm missing something about how Cassandra
works? Only one Cassandra instance is used in the test.

Thanks.

Jiang

Mime
View raw message