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
|
--source include/big_test.inc
--source include/master-slave.inc
--source include/have_binlog_format_mixed_or_row.inc
let $max_workers= 4;
--connection slave
SET @save_replica_parallel_workers= @@replica_parallel_workers;
SET @save_default_storage_engine=@@global.default_storage_engine;
SET @@global.default_storage_engine='innodb';
eval SET GLOBAL replica_parallel_workers= $max_workers;
# As the test case is not going to do any synchronization with the master
# before issuing STOP SLAVE in the non-deterministic activity, there is a
# chance that the slave applier be in MTS mode and in a condition that it
# will throw the following error message:
call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
call mtr.add_suppression("Request to stop replica SQL Thread received while applying a group that has non-transactional changes");
--source include/stop_slave.inc
--source include/start_slave.inc
--connection master
SET @save_default_storage_engine=@@global.default_storage_engine;
SET @@global.default_storage_engine='innodb';
SET @@session.default_storage_engine='innodb';
call mtr.add_suppression('.*Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*');
let $i= 10;
let $slave_status= 0;
while ($i) {
eval CREATE DATABASE test_$i;
eval CREATE TABLE test_$i.t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(20), c BLOB, d INT NOT NULL DEFAULT 0);
dec $i;
}
--sync_slave_with_master
--connection master
--disable_query_log
--disable_warnings
let $slave_status= 0;
let $trx= 0;
let $alter= 0;
let $i= 200; # with bigger value test times out on some PB hosts
--let $small_test=`SELECT @@replica_parallel_type='LOGICAL_CLOCK' OR $VALGRIND_TEST`
if ($small_test)
{
# test may be slow on Valgrind or on MTS SUBMODE = LOGICAL CLOCK
let $i=50;
}
if (`select @@binlog_format like "STATEMENT"`) {
# relax mtr to scan unsafe warnings
let $i=50;
}
while ($i) {
if (`SELECT 10*RAND() > 8`) {
if ($trx) {
COMMIT;
let $trx= 0;
}
}
if (`SELECT 10*RAND() > 8`) {
if (!$trx) {
BEGIN;
let $trx= 1;
}
}
let $db= `SELECT FLOOR(10*RAND())+1`;
let $k= 10;
while ($k) {
eval INSERT INTO test_$k.t1 VALUES ($i, 'test', NULL, 0);
dec $k;
}
let $k= 10;
while ($k) {
eval UPDATE test_$k.t1 SET d=a WHERE a = FLOOR(1000*RAND());
dec $k;
}
eval DELETE FROM test_$db.t1 WHERE a = FLOOR(1000*RAND());
if (`SELECT 10*RAND() > 5`) {
eval UPDATE test_$db.t1 SET c=REPEAT('a', 1000) WHERE a < $i;
}
if ($trx) {
if (`SELECT 10*RAND() > 8`) {
let $k= 10;
while ($k) {
# Can't be CREATE .. SELECT here because of BUG#11756034 that allows STOP SLAVE
# in the middle of CREATE-SELECT caused group.
# TODO: fix the bug and create a use case.
eval CREATE TABLE test_$k.t0 (a INT NOT NULL PRIMARY KEY, b VARCHAR(20), c BLOB, d INT NOT NULL DEFAULT 0);
eval INSERT INTO test_$k.t0 SELECT * FROM test_$k.t1;
dec $k;
}
let $k= 10;
while ($k) {
eval DROP TABLE test_$k.t1;
dec $k;
}
let $k= 10;
while ($k) {
eval RENAME TABLE test_$k.t0 TO test_$k.t1 /* i= $i */;
dec $k;
}
}
}
if (`SELECT 10*RAND() > 9`) {
--connection slave
FLUSH LOGS;
--connection master
}
if (`SELECT 100*RAND() > 95`) {
if ($slave_status) {
--connection slave
let $workers= $max_workers;
if (`SELECT 10*RAND() > 5`) {
let $workers= 0;
}
eval SET GLOBAL replica_parallel_workers= $workers;
START SLAVE;
--connection master
let $slave_status= 0;
}
}
if (`SELECT 100*RAND() > 95`) {
if (!$slave_status)
{
--connection slave
STOP SLAVE;
--connection master
let $slave_status= 1;
}
}
dec $i;
}
--enable_warnings
--enable_query_log
--connection slave
--disable_warnings
--source include/start_slave.inc
--enable_warnings
#cleanup
--connection master
let $i= 10;
while ($i) {
eval DROP DATABASE test_$i;
dec $i;
}
SET @@global.default_storage_engine= @save_default_storage_engine;
--connection slave
SET @@global.default_storage_engine= @save_default_storage_engine;
--disable_warnings
SET GLOBAL replica_parallel_workers= @save_replica_parallel_workers;
--enable_warnings
# It may generate a big delay between master and slave, that will need more time
# to sync data
--let slave-timeout= 3600
--source include/rpl_end.inc
|