1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
|
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--let $rpl_topology=1->2->3->4
--source include/rpl_init.inc
# Test parallel replication with a multi-level replication hierarchy.
--connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
--save_master_pos
--connection server_2
--sync_with_master
--save_master_pos
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='optimistic';
--connection server_3
--sync_with_master
--save_master_pos
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='optimistic';
--connection server_4
--sync_with_master
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=slave_pos;
SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
SET GLOBAL slave_parallel_mode='optimistic';
--echo *** MDEV-6676: Test that @@skip_parallel_replication is preserved in slave binlog ***
--connection server_1
INSERT INTO t1 VALUES(1,1);
BEGIN;
INSERT INTO t1 VALUES(2,1);
INSERT INTO t1 VALUES(3,1);
COMMIT;
# Do a lot of updates on same row in sequence. These would be likely to cause
# conflicts and rollbacks in optimistic parallel replication, but we disable
# that by enabling @@skip_parallel_replication. We can test that the flag is
# preserved down the replication hierarchy by checking that no slave retries
# are made.
SET SESSION skip_parallel_replication=1;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
UPDATE t1 SET b=b+1 WHERE a=2;
SET SESSION skip_parallel_replication=0;
SELECT * FROM t1 ORDER BY a;
--source include/save_master_gtid.inc
--connection server_2
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
--connection server_3
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
--connection server_4
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
--echo *** MDEV-6676: Test that the FL_WAITED flag in GTID is preserved in slave binlog ***
--connection server_2
--source include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
SET GLOBAL slave_parallel_mode='optimistic';
--connection server_3
--source include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
SET GLOBAL slave_parallel_mode='optimistic';
--connection server_4
--source include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
SET GLOBAL slave_parallel_mode='optimistic';
--connection server_1
# Do a lot of updates on same row in sequence. Ensure that all of these but the
# first have to do a lock wait on the master, setting FL_WAITED in the GTID
# event. This should cause all slaves to not attempt to run those updates in
# parallel with prior events, so that no retries are made.
BEGIN;
UPDATE t1 SET b=b+1 WHERE a=2;
--connect (con_temp1,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting1";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting1";
--connect (con_temp2,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting2";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting2";
--connect (con_temp3,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting3";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting3";
--connect (con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting4";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting4";
--connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting5";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting5";
--connect (con_temp6,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting6";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting6";
--connect (con_temp7,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting7";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting7";
--connect (con_temp8,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
SET debug_sync="thd_report_wait_for SIGNAL waiting8";
send UPDATE t1 SET b=b+1 WHERE a=2;
--connection server_1
SET debug_sync="now WAIT_FOR waiting8";
COMMIT;
SET debug_sync="RESET";
--connection con_temp1
reap;
COMMIT;
--connection con_temp2
reap;
COMMIT;
--connection con_temp3
reap;
COMMIT;
--connection con_temp4
reap;
COMMIT;
--connection con_temp5
reap;
COMMIT;
--connection con_temp6
reap;
COMMIT;
--connection con_temp7
reap;
COMMIT;
--connection con_temp8
reap;
--connection server_1
SELECT * FROM t1 ORDER BY a;
--source include/save_master_gtid.inc
--connection server_2
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
--connection server_3
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
--connection server_4
--let $retry1= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
--let $retry2= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1)
--disable_query_log
eval SELECT IF($retry1=$retry2, "Ok, no retry",
CONCAT("ERROR: ", $retry2-$retry1, " retries during replication (was ",
$retry1, " now ", $retry2, ")")) AS status;
--enable_query_log
# Clean up
--connection server_2
--source include/stop_slave.inc
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc
--connection server_3
--source include/stop_slave.inc
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc
--connection server_4
--source include/stop_slave.inc
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc
--connection server_1
DROP TABLE t1;
--source include/rpl_end.inc
|