forked from thepaul/cassandra-dtest
-
Notifications
You must be signed in to change notification settings - Fork 2
/
super_column_cache_test.py
52 lines (42 loc) · 1.84 KB
/
super_column_cache_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
from dtest import Tester
from assertions import *
from tools import *
import os, sys, time, tools
from uuid import UUID
from ccmlib.cluster import Cluster
def assert_columns(cli, names):
assert not cli.has_errors(), cli.errors()
output = cli.last_output()
for name in names:
assert re.search('name=%s' % name, output) is not None, 'Cannot find column %s in %s' % (name, output)
class TestSCCache(Tester):
def sc_with_row_cache_test(self):
""" Test for bug reported in #4190 """
cluster = self.cluster
cluster.populate(1).start()
node1 = cluster.nodelist()[0]
time.sleep(0.2)
cli = node1.cli()
cli.do("create keyspace ks")
cli.do("use ks")
if cluster.version() < "1.1":
cli.do("""
create column family Users
with column_type='Super' and key_validation_class='UTF8Type' and comparator='UTF8Type' and subcomparator='UTF8Type' and default_validation_class='UTF8Type'
and rows_cached=75000 and row_cache_provider='ConcurrentLinkedHashCacheProvider';
""")
else:
cli.do("""
create column family Users
with column_type='Super' and key_validation_class='UTF8Type' and comparator='UTF8Type' and subcomparator='UTF8Type' and default_validation_class='UTF8Type'
and caching='ROWS_ONLY';
""")
cli.do("set Users['mina']['attrs']['name'] = 'Mina'")
cli.do("get Users['mina']")
assert_columns(cli, ['name'])
cli.do("set Users['mina']['attrs']['country'] = 'Canada'")
cli.do("get Users['mina']")
assert_columns(cli, ['name', 'country'])
cli.do("set Users['mina']['attrs']['region'] = 'Quebec'")
cli.do("get Users['mina']")
assert_columns(cli, ['name', 'country', 'region'])