Hi,
I'm running some test to see if cassandra meets the needs of our data model. This particular test involves a python script that simply inserts large amounts of data to a table and then truncates it. Everything works fine unless the row count closes on 1 mil. Then the truncate command tends to pop a error from time to time.
Traceback (most recent call last):
File "WaterFall.py", line 218, in <module>
testBatch(count, batchSize)
File "WaterFall.py", line 162, in testBatch
cursor.execute("TRUNCATE TEST");
File "/usr/fast/python27/lib/python2.7/site-packages/cql/cursor.py", line 80, in execute
response = self.get_response(prepared_q, cl)
File "/usr/fast/python27/lib/python2.7/site-packages/cql/thrifteries.py", line 80, in get_response
return self.handle_cql_execution_errors(doquery, compressed_q, compress)
File "/usr/fast/python27/lib/python2.7/site-packages/cql/thrifteries.py", line 102, in handle_cql_execution_errors
raise cql.OperationalError("Unable to complete request: one or "
cql.apivalues.OperationalError: Unable to complete request: one or more nodes were unavailable.
can someone please shed some light on this ?
Cassandra Schema
CREATE KEYSPACE keybase
WITH strategy_class = 'org.apache.cassandra.locator.SimpleStrategy'
AND strategy_options:replication_factor='1';
CREATE TABLE TEST(
one varchar PRIMARY KEY,
two int,
three varchar ,
four varchar ,
five varchar );
CREATE INDEX testTwo ON Test(two);
python code
def testBatch(count,batchSize):
total=count*batchSize
print "RUNNING TEST : BATCH INSERT WITH ROW COUNT %d" %total
a = datetime.datetime.now()
n=0
for x in range(count):
cql="BEGIN BATCH USING CONSISTENCY QUORUM\n"
for y in range(batchSize):
n=n+1
cql=cql+ "INSERT INTO TEST (one,two,three,four,five) VALUES ('%s',%s,'%s','%s','%s');\n" %(n,n,n,n,n)
cql=cql+"APPLY BATCH;"
try:
cursor.execute(cql)
except :
raise
b = datetime.datetime.now()
c=b-a
print "Time - %s.%s" %(c.seconds,c.microseconds)
try:
cursor.execute("SELECT * FROM TEST");
except :
raise
"""print "ROW COUNT %s" %cursor.rowcount"""
log("Batch Run - Time - %s.%s" %(c.seconds,c.microseconds))
try:
cursor.execute("TRUNCATE TEST");
except :
raise
Python version: 2.7
dbapi2 version: 1.4
Cassandra version: 1.1
CQL: 1.3
