1
--source include/have_partition.inc
2
--source include/have_innodb.inc
3
--source include/master-slave.inc
7
let $engine_type= 'innodb';
9
SET GLOBAL binlog_format = 'ROW';
10
SET SESSION binlog_format = 'ROW';
11
select @@global.binlog_format, @@session.binlog_format;
14
DROP TABLE IF EXISTS t1, t2, t3;
15
DROP PROCEDURE IF EXISTS p1;
16
DROP PROCEDURE IF EXISTS p2;
17
DROP PROCEDURE IF EXISTS p3;
20
eval CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT,
21
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
22
fkid MEDIUMINT, filler VARCHAR(255),
23
PRIMARY KEY(id)) ENGINE=$engine_type;
25
eval CREATE TABLE t2(id MEDIUMINT NOT NULL AUTO_INCREMENT,
26
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
27
fkid MEDIUMINT, filler VARCHAR(255),
28
PRIMARY KEY(id)) ENGINE=$engine_type
29
PARTITION BY KEY(id) partitions 5;
31
eval CREATE TABLE t3(id MEDIUMINT NOT NULL AUTO_INCREMENT,
32
dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
33
fkid MEDIUMINT, filler VARCHAR(255),
34
PRIMARY KEY(id)) ENGINE=$engine_type
35
PARTITION BY RANGE(id)
36
SUBPARTITION BY hash(id) subpartitions 2
37
(PARTITION pa1 values less than (10),
38
PARTITION pa2 values less than (20),
39
PARTITION pa3 values less than (30),
40
PARTITION pa4 values less than (40),
41
PARTITION pa5 values less than (50),
42
PARTITION pa6 values less than (60),
43
PARTITION pa7 values less than (70),
44
PARTITION pa8 values less than (80),
45
PARTITION pa9 values less than (90),
46
PARTITION pa10 values less than (100),
47
PARTITION pa11 values less than MAXVALUE);
49
######## Create SPs, Functions, Views and Triggers Section ##############
54
DECLARE ins_count INT DEFAULT 1000;
55
DECLARE del_count INT;
56
DECLARE cur_user VARCHAR(255);
57
DECLARE local_uuid VARCHAR(255);
58
DECLARE local_time TIMESTAMP;
60
SET local_time= NOW();
61
SET cur_user= CURRENT_USER();
62
SET local_uuid= UUID();
64
WHILE ins_count > 0 DO
65
INSERT INTO t1 VALUES (NULL, NOW(), USER() , UUID(),
66
ins_count,'Going to test MBR for MySQL');
67
SET ins_count = ins_count - 1;
70
SELECT MAX(id) FROM t1 INTO del_count;
71
WHILE del_count > 0 DO
72
DELETE FROM t1 WHERE id = del_count;
73
SET del_count = del_count - 2;
79
DECLARE ins_count INT DEFAULT 1000;
80
DECLARE del_count INT;
81
DECLARE cur_user VARCHAR(255);
82
DECLARE local_uuid VARCHAR(255);
83
DECLARE local_time TIMESTAMP;
85
SET local_time= NOW();
86
SET cur_user= CURRENT_USER();
87
SET local_uuid= UUID();
89
WHILE ins_count > 0 DO
90
INSERT INTO t2 VALUES (NULL, NOW(), USER() , UUID(),
91
ins_count,'Going to test MBR for MySQL');
92
SET ins_count = ins_count - 1;
95
SELECT MAX(id) FROM t2 INTO del_count;
96
WHILE del_count > 0 DO
97
DELETE FROM t2 WHERE id = del_count;
98
SET del_count = del_count - 2;
102
CREATE PROCEDURE p3()
104
DECLARE ins_count INT DEFAULT 1000;
105
DECLARE del_count INT;
106
DECLARE cur_user VARCHAR(255);
107
DECLARE local_uuid VARCHAR(255);
108
DECLARE local_time TIMESTAMP;
110
SET local_time= NOW();
111
SET cur_user = CURRENT_USER();
112
SET local_uuid=UUID();
114
WHILE ins_count > 0 DO
115
INSERT INTO t3 VALUES (NULL, NOW(), USER(), UUID(),
116
ins_count,'Going to test MBR for MySQL');
117
SET ins_count = ins_count - 1;
120
SELECT MAX(id) FROM t3 INTO del_count;
121
WHILE del_count > 0 DO
122
DELETE FROM t3 WHERE id = del_count;
123
SET del_count = del_count - 2;
129
############ Finish Setup Section ###################
132
############ Test Section ###################
135
SELECT count(*) as "Master regular" FROM t1;
137
SELECT count(*) as "Master bykey" FROM t2;
139
SELECT count(*) as "Master byrange" FROM t3;
141
#--source include/master-slave-end.inc
142
--sync_slave_with_master
144
show create table t3;
145
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
146
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
148
SELECT count(*) "Slave norm" FROM t1;
149
SELECT count(*) "Slave bykey" FROM t2;
150
SELECT count(*) "Slave byrange" FROM t3;
153
DROP TABLE t1, t2, t3;
154
DROP PROCEDURE IF EXISTS p1;
155
DROP PROCEDURE IF EXISTS p2;
156
DROP PROCEDURE IF EXISTS p3;