summaryrefslogtreecommitdiff
path: root/mysql-test/r/cassandra.result
blob: 096e501ceae5d4f445405987d50510311082a9ac (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
drop table if exists t0, t1;
create table t1 (a int) engine=cassandra 
thrift_host='localhost' keyspace='foo' column_family='colfam';
ERROR 42000: Incorrect column name 'First column must be named 'rowkey''
create table t1 (a int primary key, b int) engine=cassandra
thrift_host='localhost' keyspace='foo' column_family='colfam';
ERROR 42000: Incorrect column name 'First column must be named 'rowkey''
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra 
thrift_host='127.0.0.2' keyspace='foo' column_family='colfam';
ERROR HY000: Unable to connect to foreign data source: connect() failed: Connection refused [1]
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra 
thrift_host='localhost' keyspace='no_such_keyspace' column_family='colfam';
ERROR HY000: Unable to connect to foreign data source: Default TException. [Keyspace no_such_keyspace does not exist]
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra 
thrift_host='localhost' keyspace='no_such_keyspace';
ERROR HY000: Unable to connect to foreign data source: thrift_host, keyspace, and column_family table options must be s
# Now, create a table for real and insert data
create table t1 (rowkey varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra 
thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1';
# Just in case there were left-overs from previous:
delete from t1;
select * from t1;
rowkey	data1	data2
insert into t1 values ('rowkey10', 'data1-value', 123456);
insert into t1 values ('rowkey11', 'data1-value2', 34543);
insert into t1 values ('rowkey12', 'data1-value3', 454);
select * from t1;
rowkey	data1	data2
rowkey12	data1-value3	454
rowkey10	data1-value	123456
rowkey11	data1-value2	34543
explain
select * from t1 where rowkey='rowkey11';
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	const	PRIMARY	PRIMARY	38	const	1	
select * from t1 where rowkey='rowkey11';
rowkey	data1	data2
rowkey11	data1-value2	34543
delete from t1 where rowkey='rowkey11';
select * from t1;
rowkey	data1	data2
rowkey12	data1-value3	454
rowkey10	data1-value	123456
rowkey11	NULL	NULL
delete from t1;
select * from t1;
rowkey	data1	data2
#
# A query with filesort (check that table_flags() & HA_REC_NOT_IN_SEQ,
#  also check ::rnd_pos()
#
insert into t1 values ('rowkey10', 'data1-value', 123456);
insert into t1 values ('rowkey11', 'data1-value2', 34543);
insert into t1 values ('rowkey12', 'data1-value3', 454);
select * from t1 order by data2;
rowkey	data1	data2
rowkey12	data1-value3	454
rowkey11	data1-value2	34543
rowkey10	data1-value	123456
delete from t1;
drop table t1;
#
# MDEV-476: Cassandra: Server crashes in calculate_key_len on DELETE with ORDER BY
#
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
INSERT INTO t1 VALUES (1,1),(2,2);
DELETE FROM t1 ORDER BY a LIMIT 1;
DROP TABLE t1;
#
# Batched INSERT
#
show variables like 'cassandra_insert_batch_size';
Variable_name	Value
cassandra_insert_batch_size	100
show status like 'cassandra_row_insert%';
Variable_name	Value
Cassandra_row_inserts	8
Cassandra_row_insert_batches	7
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
delete from t1;
INSERT INTO t1 VALUES (1,1),(2,2);
DELETE FROM t1 ORDER BY a LIMIT 1;
DROP TABLE t1;
show status like 'cassandra_row_insert%';
Variable_name	Value
Cassandra_row_inserts	10
Cassandra_row_insert_batches	8
# FLUSH STATUS doesn't work for our variables, just like with InnoDB.
flush status;
show status like 'cassandra_row_insert%';
Variable_name	Value
Cassandra_row_inserts	10
Cassandra_row_insert_batches	8
#
# Batched Key Access
#
# Control variable (we are not yet able to make use of MRR's buffer)
show variables like 'cassandra_multi%';
Variable_name	Value
cassandra_multiget_batch_size	100
# MRR-related status variables:
show status like 'cassandra_multi%';
Variable_name	Value
Cassandra_multiget_reads	0
Cassandra_multiget_keys_scanned	0
Cassandra_multiget_rows_read	0
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
delete from t1;
INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
set @tmp_jcl=@@join_cache_level;
set join_cache_level=8;
explain select * from t1 A, t1 B where B.rowkey=A.a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	A	ALL	NULL	NULL	NULL	NULL	1000	Using where
1	SIMPLE	B	eq_ref	PRIMARY	PRIMARY	8	test.A.a	1	Using join buffer (flat, BKAH join); multiget_slice
select * from t1 A, t1 B where B.rowkey=A.a;
rowkey	a	rowkey	a
0	0	0	0
1	1	1	1
2	2	2	2
3	3	3	3
4	4	4	4
5	5	5	5
6	6	6	6
7	7	7	7
8	8	8	8
9	9	9	9
show status like 'cassandra_multi%';
Variable_name	Value
Cassandra_multiget_reads	1
Cassandra_multiget_keys_scanned	10
Cassandra_multiget_rows_read	10
insert into t1 values(1, 8);
insert into t1 values(3, 8);
insert into t1 values(5, 8);
insert into t1 values(7, 8);
select * from t1 A, t1 B where B.rowkey=A.a;
rowkey	a	rowkey	a
0	0	0	0
2	2	2	2
4	4	4	4
6	6	6	6
1	8	8	8
7	8	8	8
8	8	8	8
5	8	8	8
3	8	8	8
9	9	9	9
show status like 'cassandra_multi%';
Variable_name	Value
Cassandra_multiget_reads	2
Cassandra_multiget_keys_scanned	16
Cassandra_multiget_rows_read	16
delete from t1;
drop table t1;