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
|
drop table if exists t1,t2;
# Tests for MyRocks + partitioning
#
# MyRocks Issue #70: Server crashes in Rdb_key_def::get_primary_key_tuple
#
CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, KEY(f2)) ENGINE=RocksDB
PARTITION BY HASH(pk) PARTITIONS 2;
INSERT INTO t1 VALUES (1, 6, NULL), (2, NULL, 1);
CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT) ENGINE=RocksDB;
INSERT INTO t2 VALUES (1, 1), (2, 1);
SELECT f1 FROM t1 WHERE f2 = ( SELECT f1 FROM t2 WHERE pk = 2 );
f1
NULL
drop table t1,t2;
#
# Issue#105: key_info[secondary_key].actual_key_parts does not include primary key on partitioned tables
#
CREATE TABLE t1 (
id INT PRIMARY KEY,
a set ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') CHARACTER SET utf8,
b set ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') CHARACTER SET utf8 default null,
c set ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z') CHARACTER SET utf8 not null,
INDEX (a),
INDEX (b),
INDEX (c)
) ENGINE=RocksDB PARTITION BY key (id) partitions 2;
INSERT INTO t1 (id, b) VALUES (28, 3);
Warnings:
Warning 1364 Field 'c' doesn't have a default value
UPDATE t1 SET id=8 WHERE c < 8 LIMIT 1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
#
# Issue #105, another testcase
#
create table t1 (
pk int primary key,
col1 int,
col2 int,
key (col1) comment 'rev:cf_issue105'
) engine=rocksdb partition by hash(pk) partitions 2;
insert into t1 values (1,10,10);
insert into t1 values (2,10,10);
insert into t1 values (11,20,20);
insert into t1 values (12,20,20);
explain select * from t1 force index(col1) where col1=10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref col1 col1 5 const 2000
select * from t1 force index(col1) where col1=10;
pk col1 col2
1 10 10
2 10 10
select * from t1 use index () where col1=10;
pk col1 col2
2 10 10
1 10 10
drop table t1;
#
# Issue #108: Index-only scans do not work for partitioned tables and extended keys
#
create table t1 (
pk int primary key,
col1 int,
col2 int,
key (col1)
) engine=rocksdb partition by hash(pk) partitions 2;
insert into t1 values (1,10,10);
insert into t1 values (2,10,10);
insert into t1 values (11,20,20);
insert into t1 values (12,20,20);
# The following must use "Using index"
explain select pk from t1 force index(col1) where col1=10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref col1 col1 5 const 2000 Using index
drop table t1;
#
# Issue #214: subqueries cause crash
#
create TABLE t1(a int,b int,c int,primary key(a,b))
partition by list (b*a) (partition x1 values in (1) tablespace ts1,
partition x2 values in (3,11,5,7) tablespace ts2,
partition x3 values in (16,8,5+19,70-43) tablespace ts3);
create table t2(b binary(2));
set session optimizer_switch='materialization=off';
insert into t1(a,b) values(1,7);
select a from t1 where a in (select a from t1 where a in (select b from t2));
a
drop table t1, t2;
#
# Issue #260: altering name to invalid value leaves table unaccessible
#
CREATE TABLE t1 (c1 INT NOT NULL, c2 CHAR(5)) PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t1 VALUES(1,'a');
RENAME TABLE t1 TO db3.t3;
ERROR HY000: Error on rename of './test/t1' to './db3/t3' (errno: 122 "Internal (unspecified) error in handler")
SELECT * FROM t1;
c1 c2
1 a
SHOW TABLES;
Tables_in_test
t1
RENAME TABLE t1 TO test.t3;
SELECT * FROM t3;
c1 c2
1 a
SHOW TABLES;
Tables_in_test
t3
CREATE DATABASE db3;
USE test;
RENAME TABLE t3 to db3.t2;
USE db3;
SELECT * FROM t2;
c1 c2
1 a
SHOW TABLES;
Tables_in_db3
t2
DROP TABLE t2;
use test;
DROP DATABASE db3;
|