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