diff --git a/swh/storage/cassandra/cql.py b/swh/storage/cassandra/cql.py --- a/swh/storage/cassandra/cql.py +++ b/swh/storage/cassandra/cql.py @@ -38,16 +38,20 @@ # datacenter as the client (DCAwareRoundRobinPolicy) -def create_keyspace(hosts: List[str], keyspace: str, port: int = 9042): +def create_keyspace(hosts: List[str], keyspace: str, port: int = 9042, + *, durable_writes=True): cluster = Cluster( hosts, port=port, execution_profiles=_execution_profiles) session = cluster.connect() + extra_params = '' + if not durable_writes: + extra_params = 'AND durable_writes = false' session.execute('''CREATE KEYSPACE IF NOT EXISTS "%s" WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 - }; - ''' % keyspace) + } %s; + ''' % (keyspace, extra_params)) session.execute('USE "%s"' % keyspace) for query in CREATE_TABLES_QUERIES: session.execute(query) diff --git a/swh/storage/tests/test_cassandra.py b/swh/storage/tests/test_cassandra.py --- a/swh/storage/tests/test_cassandra.py +++ b/swh/storage/tests/test_cassandra.py @@ -42,6 +42,12 @@ listen_address: 127.0.0.1 enable_user_defined_functions: true + +# speed-up by disabling period saving to disk +key_cache_save_period: 0 +row_cache_save_period: 0 +trickle_fsync: false +commitlog_sync_period_in_ms: 100000 '''