forked from thepaul/cassandra-dtest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsstablesplit_test.py
53 lines (46 loc) · 1.86 KB
/
sstablesplit_test.py
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
43
44
45
46
47
48
49
50
51
52
53
from dtest import Tester, debug
from assertions import *
from tools import *
from os.path import getsize
import time
class TestSSTableSplit(Tester):
def split_test(self):
"""
Check that after running compaction, sstablessplit can succesfully split
The resultant sstable. Check that split is reversable and that data is readable
after carrying out these operations.
"""
cluster = self.cluster
cluster.populate(1).start()
node = cluster.nodelist()[0]
version = cluster.version()
debug("Run stress to insert data")
if version < "2.1":
node.stress( ['-o', 'insert'] )
else:
node.stress( ['write', 'n=1100000', '-rate', 'threads=8'] )
self._do_compaction(node)
self._do_split(node, version)
self._do_compaction(node)
self._do_split(node, version)
debug("Run stress to ensure data is readable")
if version < "2.1":
node.stress( ['-o', 'read'] )
else:
node.stress( ['read', 'n=1100000', '-rate', 'threads=8'] )
def _do_compaction(self, node):
debug("Compact sstables.")
node.compact()
sstables = node.get_sstables('Keyspace1', '')
def _do_split(self, node, version):
debug("run sstablesplit")
time.sleep(5.0)
node.stop()
node.run_sstablesplit( keyspace='Keyspace1' )
sstables = node.get_sstables('Keyspace1', '')
assert len(sstables) == 6, "Incorrect number of sstables after running sstablesplit."
if version < "2.1":
assert max( [ getsize( sstable ) for sstable in sstables ] ) <= 52428960, "Max sstables size should be 52428960."
else:
assert max( [ getsize( sstable ) for sstable in sstables ] ) <= 52428980, "Max sstables size should be 52428980."
node.start()