I run into trouble after a while if I delete rows, this happens in both
2.1.3 and 2.0.13, and I encountered the same problem when using either the
datastax java driver or the stock python driver.
The problem is reproducible using the attached python program.

Once the problem is encountered, the table becomes unusable..

cqlsh:test1> select id from msg limit 1;
Request did not complete within rpc_timeout.

So, questions are:
am I doing something wrong ?
is this expected behaviour ?
is there some way to fix the table and make it usable again once this has
happened ?
if this is a bug, what is the best way of reporting it ?

Many thanks
Joss
from cassandra.cluster import Cluster
cluster = Cluster()
session = cluster.connect()

num_msgs = 100000 

# session.execute("DROP KEYSPACE test1 IF EXISTS test1;")
session.execute("CREATE KEYSPACE test1 WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 1};")
session.execute("""CREATE TABLE test1.msg ( 
 author	text, 
 id     timeuuid,
 txt    text,
 PRIMARY KEY (author,id)                    
) WITH CLUSTERING ORDER BY (id DESC);""")



fetch_st = session.prepare("SELECT id,author,txt FROM test1.msg WHERE author=? limit 100");
insert_st = session.prepare("INSERT INTO test1.msg(id,author,txt) VALUES(now(),?,?)");
del_st = session.prepare("DELETE FROM test1.msg where author=? and id=?");

author = "some author"

for i in range(0,num_msgs):
  session.execute(insert_st, [author,"some message " + str(i)])

msgs = session.execute(fetch_st,[author])
deleted = 0
while len(msgs) > 0:
  for m in msgs:
    session.execute(del_st,[author,m[0]])
  deleted += len(msgs)
  print "deleted " + str(deleted)
  msgs = session.execute(fetch_st,[author])

Reply via email to