forked from thepaul/cassandra-dtest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeletion_test.py
More file actions
43 lines (32 loc) · 1.36 KB
/
deletion_test.py
File metadata and controls
43 lines (32 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from dtest import Tester
from assertions import *
import os, sys, time, tools
from ccmlib.cluster import Cluster
class TestDeletion(Tester):
def gc_test(self):
""" Test that tombstone are fully purge after gc_grace """
cluster = self.cluster
cluster.populate(1).start()
[node1] = cluster.nodelist()
time.sleep(.5)
cursor = self.cql_connection(node1).cursor()
self.create_ks(cursor, 'ks', 1)
self.create_cf(cursor, 'cf', gc_grace=0, key_type='int', columns={'c1': 'int'})
cursor.execute('insert into cf (key, c1) values (1,1)')
cursor.execute('insert into cf (key, c1) values (2,1)')
node1.flush()
cursor.execute('select * from cf;')
result = cursor.fetchall()
assert len(result) == 2 and len(result[0]) == 2 and len(result[1]) == 2, result
cursor.execute('delete from cf where key=1')
cursor.execute('select * from cf;')
result = cursor.fetchall()
if cluster.version() < '1.2': # > 1.2 doesn't show tombstones
assert len(result) == 2 and len(result[0]) == 1 and len(result[1]) == 1, result
node1.flush()
time.sleep(.5)
node1.compact()
time.sleep(.5)
cursor.execute('select * from cf;')
result = cursor.fetchall()
assert len(result) == 1 and len(result[0]) == 2, result