1# 2# Tests for cassandra storage engine 3# 4-- source include/have_query_cache.inc 5 6if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'cassandra' AND support IN ('YES', 'DEFAULT', 'ENABLED')`) 7{ 8 --skip Test requires Cassandra. 9} 10 11--disable_warnings 12drop table if exists t1, t2; 13--enable_warnings 14 15############################################################################ 16## Cassandra initialization 17############################################################################ 18 19# Step 1: remove the keyspace that could be left over from the previous test 20--remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_cleanup.cql 21--write_file $MYSQLTEST_VARDIR/cassandra_test_cleanup.cql 22drop keyspace mariadbtest2; 23EOF 24--error 0,1,2 25--system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_cleanup.cql 26 27# Step 2: create new keyspace and test column families 28--remove_files_wildcard $MYSQLTEST_VARDIR cassandra_test_init.cql 29--write_file $MYSQLTEST_VARDIR/cassandra_test_init.cql 30 31CREATE KEYSPACE mariadbtest2 32 WITH strategy_class = 'org.apache.cassandra.locator.SimpleStrategy' 33 AND strategy_options:replication_factor='1'; 34 35USE mariadbtest2; 36create columnfamily cf1 ( rowkey int primary key, a int ); 37EOF 38 39--error 0,1,2 40--system cqlsh -3 -f $MYSQLTEST_VARDIR/cassandra_test_init.cql 41 42############################################################################ 43## The test itsef: 44############################################################################ 45 46create table t1 (rowkey int primary key, a int) engine=cassandra 47 thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1'; 48create table t2 like t1; 49 50set global query_cache_size=1024*1024; 51 52select * from t1; 53insert into t2 values (1,1); 54 55select * from t1; 56select sql_no_cache * from t1; 57 58drop table t1,t2; 59set global QUERY_CACHE_SIZE=0; 60