Debian Codegraph @

mysql-test/suite/parts/t/rpl_partition.test

raw
1 --source include/have_partition.inc
2 --source include/have_innodb.inc
3 --source include/big_test.inc
4 --source include/master-slave.inc
5
6 --vertical_results
7
8 let $engine_type= 'innodb';
9
10 set @old_global_binlog_format= @@global.binlog_format;
11 set @old_session_binlog_format= @@session.binlog_format;
12 SET GLOBAL binlog_format = 'ROW';
13 SET SESSION binlog_format = 'ROW';
14 select @@global.binlog_format, @@session.binlog_format;
15 connection slave;
16 set @old_global_binlog_format= @@global.binlog_format;
17 set @old_session_binlog_format= @@session.binlog_format;
18 SET GLOBAL binlog_format = 'ROW';
19 SET SESSION binlog_format = 'ROW';
20 select @@global.binlog_format, @@session.binlog_format;
21 # restart slave so that slave sql thread's binlog format is re-read
22 # from @@global.binlog_format
23 --source include/stop_slave.inc
24 --source include/start_slave.inc
25 connection master;
26
27 eval CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT,
28 dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
29 fkid MEDIUMINT, filler VARCHAR(255),
30 PRIMARY KEY(id)) ENGINE=$engine_type;
31
32 eval CREATE TABLE t2(id MEDIUMINT NOT NULL AUTO_INCREMENT,
33 dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
34 fkid MEDIUMINT, filler VARCHAR(255),
35 PRIMARY KEY(id)) ENGINE=$engine_type
36 PARTITION BY KEY(id) partitions 5;
37
38 eval CREATE TABLE t3(id MEDIUMINT NOT NULL AUTO_INCREMENT,
39 dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
40 fkid MEDIUMINT, filler VARCHAR(255),
41 PRIMARY KEY(id)) ENGINE=$engine_type
42 PARTITION BY RANGE(id)
43 SUBPARTITION BY hash(id) subpartitions 2
44 (PARTITION pa1 values less than (10),
45 PARTITION pa2 values less than (20),
46 PARTITION pa3 values less than (30),
47 PARTITION pa4 values less than (40),
48 PARTITION pa5 values less than (50),
49 PARTITION pa6 values less than (60),
50 PARTITION pa7 values less than (70),
51 PARTITION pa8 values less than (80),
52 PARTITION pa9 values less than (90),
53 PARTITION pa10 values less than (100),
54 PARTITION pa11 values less than MAXVALUE);
55
56 ######## Create SPs, Functions, Views and Triggers Section ##############
57
58 delimiter |;
59 CREATE PROCEDURE p1()
60 BEGIN
61 DECLARE ins_count INT DEFAULT 1000;
62 DECLARE del_count INT;
63 DECLARE cur_user VARCHAR(255);
64 DECLARE local_uuid VARCHAR(255);
65 DECLARE local_time TIMESTAMP;
66
67 SET local_time= NOW();
68 SET cur_user= CURRENT_USER();
69 SET local_uuid= UUID();
70
71 WHILE ins_count > 0 DO
72 INSERT INTO t1 VALUES (NULL, NOW(), USER() , UUID(),
73 ins_count,'Going to test MBR for MySQL');
74 SET ins_count = ins_count - 1;
75 END WHILE;
76
77 SELECT MAX(id) INTO del_count FROM t1;
78 WHILE del_count > 0 DO
79 DELETE FROM t1 WHERE id = del_count;
80 SET del_count = del_count - 2;
81 END WHILE;
82 END|
83
84 CREATE PROCEDURE p2()
85 BEGIN
86 DECLARE ins_count INT DEFAULT 1000;
87 DECLARE del_count INT;
88 DECLARE cur_user VARCHAR(255);
89 DECLARE local_uuid VARCHAR(255);
90 DECLARE local_time TIMESTAMP;
91
92 SET local_time= NOW();
93 SET cur_user= CURRENT_USER();
94 SET local_uuid= UUID();
95
96 WHILE ins_count > 0 DO
97 INSERT INTO t2 VALUES (NULL, NOW(), USER() , UUID(),
98 ins_count,'Going to test MBR for MySQL');
99 SET ins_count = ins_count - 1;
100 END WHILE;
101
102 SELECT MAX(id) INTO del_count FROM t2;
103 WHILE del_count > 0 DO
104 DELETE FROM t2 WHERE id = del_count;
105 SET del_count = del_count - 2;
106 END WHILE;
107 END|
108
109 CREATE PROCEDURE p3()
110 BEGIN
111 DECLARE ins_count INT DEFAULT 1000;
112 DECLARE del_count INT;
113 DECLARE cur_user VARCHAR(255);
114 DECLARE local_uuid VARCHAR(255);
115 DECLARE local_time TIMESTAMP;
116
117 SET local_time= NOW();
118 SET cur_user = CURRENT_USER();
119 SET local_uuid=UUID();
120
121 WHILE ins_count > 0 DO
122 INSERT INTO t3 VALUES (NULL, NOW(), USER(), UUID(),
123 ins_count,'Going to test MBR for MySQL');
124 SET ins_count = ins_count - 1;
125 END WHILE;
126
127 SELECT MAX(id) INTO del_count FROM t3;
128 WHILE del_count > 0 DO
129 DELETE FROM t3 WHERE id = del_count;
130 SET del_count = del_count - 2;
131 END WHILE;
132 END|
133
134 delimiter ;|
135
136 ############ Finish Setup Section ###################
137
138
139 ############ Test Section ###################
140
141 begin;
142 CALL p1();
143 commit;
144 SELECT count(*) as "Master regular" FROM t1;
145 begin;
146 CALL p2();
147 commit;
148 SELECT count(*) as "Master bykey" FROM t2;
149 begin;
150 CALL p3();
151 commit;
152 SELECT count(*) as "Master byrange" FROM t3;
153
154 --sync_slave_with_master
155 connection slave;
156 show create table t3;
157 --source include/check_slave_is_running.inc
158 SELECT count(*) "Slave norm" FROM t1;
159 SELECT count(*) "Slave bykey" FROM t2;
160 SELECT count(*) "Slave byrange" FROM t3;
161
162 connection master;
163 set @@global.binlog_format= @old_global_binlog_format;
164 set @@session.binlog_format= @old_session_binlog_format;
165 DROP TABLE t1, t2, t3;
166 DROP PROCEDURE p1;
167 DROP PROCEDURE p2;
168 DROP PROCEDURE p3;
169 sync_slave_with_master;
170 set @@global.binlog_format= @old_global_binlog_format;
171 set @@session.binlog_format= @old_session_binlog_format;
172
173 # End of 5.1 tests
174 --source include/rpl_end.inc