Debian Codegraph @

mysql-test/suite/federated/federated_partition.test

raw
1 #
2 # Tests for partitioned FEDERATED
3 #
4 source have_federatedx.inc;
5 source include/have_partition.inc;
6 source include/have_innodb.inc;
7 source include/federated.inc;
8
9 disable_warnings;
10 drop table if exists t1;
11 enable_warnings;
12
13 #
14 # Federated + partition
15 #
16 # Create 2 tables on the Slave, we can use different storage engines.
17 # Then create a Federated table on the Master, using different connect
18 # string to specify the two different target partitions we want to use.
19 #
20
21 connection slave;
22 create table federated.t1_1 (s1 int primary key) engine=myisam;
23 create table federated.t1_2 (s1 int primary key) engine=innodb;
24
25 connection master;
26 --replace_result $SLAVE_MYPORT SLAVE_PORT
27 eval create table t1 (s1 int primary key) engine=federated
28 CONNECTION="remember_this"
29 partition by list (s1)
30 (partition p1 values in (1,3)
31 connection='mysql://[email protected]:$SLAVE_MYPORT/federated/t1_1',
32 partition p2 values in (2,4)
33 connection='mysql://[email protected]:$SLAVE_MYPORT/federated/t1_2');
34
35 --replace_result $SLAVE_MYPORT SLAVE_PORT
36 show create table t1;
37
38 insert into t1 values (1), (2), (3), (4);
39 select * from t1;
40
41 connection slave;
42 select * from federated.t1_1;
43 select * from federated.t1_2;
44
45 connection master;
46 drop table t1;
47
48 connection slave;
49 drop table federated.t1_1;
50 drop table federated.t1_2;
51
52 --echo End of 5.1 tests
53
54 --echo #
55 --echo # MDEV-18734 ASAN heap-use-after-free upon sorting by blob column from partitioned table
56 --echo #
57 connection slave;
58 use federated;
59 create table t1_1 (x int, b text, key(x));
60 create table t1_2 (x int, b text, key(x));
61 connection master;
62 --replace_result $SLAVE_MYPORT SLAVE_PORT
63 eval create table t1 (x int, b text, key(x)) engine=federated
64 partition by range columns (x) (
65 partition p1 values less than (40) connection='mysql://[email protected]:$SLAVE_MYPORT/federated/t1_1',
66 partition pn values less than (maxvalue) connection='mysql://[email protected]:$SLAVE_MYPORT/federated/t1_2'
67 );
68 insert t1 values (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8);
69 insert t1 select x + 8, x + 8 from t1;
70 insert t1 select x + 16, x + 16 from t1;
71 insert t1 select x + 49, repeat(x + 49, 100) from t1;
72 flush tables;
73 --echo # This produces wrong result before MDEV-17573
74 select x, left(b, 10) from t1 where x > 30 and x < 60 order by b;
75 drop table t1;
76 connection slave;
77 drop table t1_1, t1_2;
78
79 source include/federated_cleanup.inc;