| 1 |
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,; |
| 2 |
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; |
| 3 |
connection master; |
| 4 |
CREATE DATABASE federated; |
| 5 |
connection slave; |
| 6 |
CREATE DATABASE federated; |
| 7 |
drop table if exists t1; |
| 8 |
connection slave; |
| 9 |
create table federated.t1_1 (s1 int primary key) engine=myisam; |
| 10 |
create table federated.t1_2 (s1 int primary key) engine=innodb; |
| 11 |
connection master; |
| 12 |
create table t1 (s1 int primary key) engine=federated |
| 13 |
CONNECTION="remember_this" |
| 14 |
partition by list (s1) |
| 15 |
(partition p1 values in (1,3) |
| 16 |
connection='mysql://[email protected]:SLAVE_PORT/federated/t1_1', |
| 17 |
partition p2 values in (2,4) |
| 18 |
connection='mysql://[email protected]:SLAVE_PORT/federated/t1_2'); |
| 19 |
show create table t1; |
| 20 |
Table Create Table |
| 21 |
t1 CREATE TABLE `t1` ( |
| 22 |
`s1` int(11) NOT NULL, |
| 23 |
PRIMARY KEY (`s1`) |
| 24 |
) ENGINE=FEDERATED DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci CONNECTION='remember_this' |
| 25 |
PARTITION BY LIST (`s1`) |
| 26 |
(PARTITION `p1` VALUES IN (1,3) CONNECTION = 'mysql://[email protected]:SLAVE_PORT/federated/t1_1' ENGINE = FEDERATED, |
| 27 |
PARTITION `p2` VALUES IN (2,4) CONNECTION = 'mysql://[email protected]:SLAVE_PORT/federated/t1_2' ENGINE = FEDERATED) |
| 28 |
insert into t1 values (1), (2), (3), (4); |
| 29 |
select * from t1; |
| 30 |
s1 |
| 31 |
1 |
| 32 |
3 |
| 33 |
2 |
| 34 |
4 |
| 35 |
connection slave; |
| 36 |
select * from federated.t1_1; |
| 37 |
s1 |
| 38 |
1 |
| 39 |
3 |
| 40 |
select * from federated.t1_2; |
| 41 |
s1 |
| 42 |
2 |
| 43 |
4 |
| 44 |
connection master; |
| 45 |
drop table t1; |
| 46 |
connection slave; |
| 47 |
drop table federated.t1_1; |
| 48 |
drop table federated.t1_2; |
| 49 |
End of 5.1 tests |
| 50 |
# |
| 51 |
# MDEV-18734 ASAN heap-use-after-free upon sorting by blob column from partitioned table |
| 52 |
# |
| 53 |
connection slave; |
| 54 |
use federated; |
| 55 |
create table t1_1 (x int, b text, key(x)); |
| 56 |
create table t1_2 (x int, b text, key(x)); |
| 57 |
connection master; |
| 58 |
create table t1 (x int, b text, key(x)) engine=federated |
| 59 |
partition by range columns (x) ( |
| 60 |
partition p1 values less than (40) connection='mysql://[email protected]:SLAVE_PORT/federated/t1_1', |
| 61 |
partition pn values less than (maxvalue) connection='mysql://[email protected]:SLAVE_PORT/federated/t1_2' |
| 62 |
); |
| 63 |
insert t1 values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8); |
| 64 |
insert t1 select x + 8, x + 8 from t1; |
| 65 |
insert t1 select x + 16, x + 16 from t1; |
| 66 |
insert t1 select x + 49, repeat(x + 49, 100) from t1; |
| 67 |
flush tables; |
| 68 |
# This produces wrong result before MDEV-17573 |
| 69 |
select x, left(b, 10) from t1 where x > 30 and x < 60 order by b; |
| 70 |
x left(b, 10) |
| 71 |
31 31 |
| 72 |
32 32 |
| 73 |
50 5050505050 |
| 74 |
51 5151515151 |
| 75 |
52 5252525252 |
| 76 |
53 5353535353 |
| 77 |
54 5454545454 |
| 78 |
55 5555555555 |
| 79 |
56 5656565656 |
| 80 |
57 5757575757 |
| 81 |
58 5858585858 |
| 82 |
59 5959595959 |
| 83 |
drop table t1; |
| 84 |
connection slave; |
| 85 |
drop table t1_1, t1_2; |
| 86 |
connection master; |
| 87 |
DROP TABLE IF EXISTS federated.t1; |
| 88 |
DROP DATABASE IF EXISTS federated; |
| 89 |
connection slave; |
| 90 |
DROP TABLE IF EXISTS federated.t1; |
| 91 |
DROP DATABASE IF EXISTS federated; |