| 1 |
# |
| 2 |
# WL#5569 MTS |
| 3 |
# |
| 4 |
# The test verifies correctness of MTS execution when system meets |
| 5 |
# various limits due to few configuration options: |
| 6 |
# |
| 7 |
# A. @@global.replica_pending_jobs_size_max |
| 8 |
# B. @@global.replica_parallel_workers |
| 9 |
# |
| 10 |
|
| 11 |
--source include/not_group_replication_plugin.inc |
| 12 |
|
| 13 |
# This test requires an artificial large transaction and relies |
| 14 |
# on its size to test the functionality. Skipping compression |
| 15 |
# so that the test is deterministic |
| 16 |
--source include/not_binlog_transaction_compression_on.inc |
| 17 |
|
| 18 |
# no support for Query-log-event in this test |
| 19 |
--source include/have_binlog_format_row.inc |
| 20 |
--source include/master-slave.inc |
| 21 |
|
| 22 |
connection slave; |
| 23 |
|
| 24 |
create view coord_wait_list as |
| 25 |
SELECT id from Information_Schema.processlist |
| 26 |
where state like 'Waiting for Replica Worker%'; |
| 27 |
|
| 28 |
# restart in Parallel |
| 29 |
|
| 30 |
let $workers= 4; |
| 31 |
|
| 32 |
source include/stop_slave.inc; |
| 33 |
set @save.replica_parallel_workers= @@global.replica_parallel_workers; |
| 34 |
eval set @@global.replica_parallel_workers= $workers; |
| 35 |
|
| 36 |
# |
| 37 |
# A. Prescribed number of Worker threads is honored |
| 38 |
# |
| 39 |
|
| 40 |
connection slave; |
| 41 |
|
| 42 |
create view worker_wait_list as |
| 43 |
SELECT id from Information_Schema.processlist |
| 44 |
where state like 'Waiting for an event from Coordinator'; |
| 45 |
|
| 46 |
source include/stop_slave.inc; |
| 47 |
|
| 48 |
# relates to B preparation |
| 49 |
let $mts_max_q_size=1024; |
| 50 |
set @save_replica_pending_jobs_size_max = @@global.replica_pending_jobs_size_max; |
| 51 |
eval set @@global.replica_pending_jobs_size_max= $mts_max_q_size; |
| 52 |
|
| 53 |
source include/start_slave.inc; |
| 54 |
|
| 55 |
let $count= $workers; |
| 56 |
let $table= worker_wait_list; |
| 57 |
source include/wait_until_rows_count.inc; |
| 58 |
|
| 59 |
--echo Configured number of Workers is started. |
| 60 |
|
| 61 |
# |
| 62 |
# B. Max size of Worker queues |
| 63 |
# |
| 64 |
|
| 65 |
|
| 66 |
connection master; |
| 67 |
create database d0; |
| 68 |
create table d0.t0 (a int auto_increment primary key, b text null) engine=innodb; |
| 69 |
|
| 70 |
--source include/sync_slave_sql_with_master.inc |
| 71 |
|
| 72 |
|
| 73 |
begin; |
| 74 |
insert into d0.t0 set a= 1; |
| 75 |
|
| 76 |
# master trans structure aims at testing C's wait loop |
| 77 |
|
| 78 |
let $i_loop= 10; |
| 79 |
|
| 80 |
connection master; |
| 81 |
|
| 82 |
begin; |
| 83 |
--disable_query_log |
| 84 |
eval insert into d0.t0 set a= 1, b= REPEAT('b', 1); |
| 85 |
|
| 86 |
while ($i_loop) |
| 87 |
{ |
| 88 |
eval insert into d0.t0 set b= REPEAT('b', 1); |
| 89 |
eval insert into d0.t0 set b= REPEAT('b', 1); |
| 90 |
eval insert into d0.t0 set b= REPEAT('b', 1); |
| 91 |
eval insert into d0.t0 set b= REPEAT('b', 1); |
| 92 |
eval insert into d0.t0 set b= REPEAT('b', 1); |
| 93 |
eval insert into d0.t0 set b= REPEAT('b', 1); |
| 94 |
eval insert into d0.t0 set b= REPEAT('b', 2* $mts_max_q_size/3); |
| 95 |
dec $i_loop; |
| 96 |
} |
| 97 |
--enable_query_log |
| 98 |
commit; |
| 99 |
|
| 100 |
let $d0_t0_count=`select count(*) from d0.t0`; |
| 101 |
|
| 102 |
connection slave; |
| 103 |
|
| 104 |
--echo *** Coordinator must be waiting for Workers have released pending events mem *** |
| 105 |
|
| 106 |
let $count= 1; |
| 107 |
let $table= coord_wait_list; |
| 108 |
source include/wait_until_rows_count.inc; |
| 109 |
|
| 110 |
rollback; |
| 111 |
|
| 112 |
let $count= $d0_t0_count; |
| 113 |
let $table= d0.t0; |
| 114 |
source include/wait_until_rows_count.inc; |
| 115 |
|
| 116 |
# cleanup of the max size |
| 117 |
set @@global.replica_pending_jobs_size_max= @save_replica_pending_jobs_size_max; |
| 118 |
|
| 119 |
|
| 120 |
# |
| 121 |
# cleanup |
| 122 |
# |
| 123 |
|
| 124 |
connection master; |
| 125 |
|
| 126 |
drop database d0; |
| 127 |
|
| 128 |
--source include/sync_slave_sql_with_master.inc |
| 129 |
#connection slave; |
| 130 |
|
| 131 |
drop view coord_wait_list; |
| 132 |
drop view worker_wait_list; |
| 133 |
--disable_warnings |
| 134 |
set @@global.replica_parallel_workers= @save.replica_parallel_workers; |
| 135 |
--enable_warnings |
| 136 |
|
| 137 |
--source include/rpl_end.inc |