3 # This file is an engine to process commands like
4 # rpl_mixing_engines.inc. It has the same set of commands, and in
5 # addition the extra command 'recovery'. The 'configure' and 'clean'
6 # commands are also extended version of the same commands in
7 # rpl_mixing_engines.inc.
11 # See rpl_mixing_engines.inc.
13 # ==== Implementation ====
15 # This file has its own code for 'configure' and 'clean'. Other
16 # commands are delegated to rpl_mixing_engines.inc.
18 --let $rmcs_initial_commands= $commands
21 # Creates tables used throughout the test and changes the type of the
22 # mysql.slave_relay_log_info to Innodb.
24 if ($commands == configure)
26 --echo ==== begin rpl_mts_crash_safe.inc:configure ====
27 --let $count_database=1
28 while ($count_database <= $max_workers)
30 --echo ---- begin configure database test_$count_database ----
32 --let $commands= configure
33 --let $database_name=test_$count_database
34 --source
extra/rpl_tests/rpl_mixing_engines.inc
35 --echo ---- end configure database test_$count_database ----
39 --sync_slave_with_master
40 --source include/stop_slave.inc
41 let $saved_workers= `SELECT @@global.slave_parallel_workers`;
42 let $saved_checkpoint= `SELECT @@global.slave_checkpoint_period`;
44 SHOW CREATE
TABLE mysql.slave_master_info;
45 SHOW CREATE
TABLE mysql.slave_relay_log_info;
46 SHOW CREATE
TABLE mysql.slave_worker_info;
47 ALTER
TABLE mysql.slave_master_info ENGINE= Innodb;
48 ALTER
TABLE mysql.slave_relay_log_info ENGINE= Innodb;
49 ALTER
TABLE mysql.slave_worker_info ENGINE= Innodb;
50 SHOW CREATE
TABLE mysql.slave_master_info;
51 SHOW CREATE
TABLE mysql.slave_relay_log_info;
52 SHOW CREATE
TABLE mysql.slave_worker_info;
54 --echo ==== end rpl_mts_crash_safe.inc:configure ====
57 if ($commands == clean)
59 --echo ==== begin rpl_mts_crash_safe.inc:clean ====
61 --source include/stop_slave.inc
63 eval SET @@global.slave_parallel_workers= $saved_workers;
64 eval SET @@global.slave_checkpoint_period= $saved_checkpoint;
66 --source include/start_slave.inc
69 --let $count_database=1
70 while ($count_database <= $max_workers)
72 --echo ---- begin clean database test_$count_database ----
73 --let $commands= clean
74 --let $database_name=test_$count_database
75 --source
extra/rpl_tests/rpl_mixing_engines.inc
76 --echo ---- end clean database test_$count_database ----
80 --echo ==== end rpl_mts_crash_safe.inc:clean ====
83 if ($commands == recovery)
85 --echo ==== begin rpl_mts_crash_safe.inc:recovery ====
87 let $m_before_master_file= query_get_value(
"SHOW MASTER STATUS",
"File", 1);
88 let $m_before_master_pos= query_get_value(
"SHOW MASTER STATUS",
"Position", 1);
90 #### Guaranteeing that all events in the binary log are transfered to the slave ######
92 let $saved_current_workers= `SELECT @@global.slave_parallel_workers`;
93 let $saved_current_checkpoint= `SELECT @@global.slave_checkpoint_period`;
94 SET GLOBAL debug=
"d,rotate_slave_debug_group";
95 --source include/start_slave_io.inc
96 let $wait_condition=SELECT Master_log_pos = $m_before_master_pos AND Master_log_name =
"$m_before_master_file" FROM mysql.slave_master_info;
97 let $show_rpl_debug_info= 1;
98 --source include/wait_condition.inc
100 #### Crashing server after assigning and processing jobs ######
103 --let $mts_run=`select @@global.slave_parallel_workers > 0`
104 eval SET @@global.slave_checkpoint_group= $count_debug_groups;
105 SET GLOBAL debug=
"d,check_slave_debug_group";
106 SET GLOBAL debug=
"+d,mts_distribute_round_robin";
107 --exec echo
"wait" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
109 START SLAVE SQL_THREAD;
110 --source include/wait_until_disconnected.inc
112 #### MTS can not relay-log-recover in presense of gaps that the test creates
113 #### The server has to be restarted with --relay-log-recovery = 0 followed by
114 #### START SLAVE UNTIL SQL_AFTER_MTS_GAPS.
118 --echo ** fixing gaps **
119 --let $rpl_server_number= 2
120 --let $rpl_server_parameters= --
skip-slave-start --relay-log-recovery=0 --slave-parallel-workers=0
123 --source include/rpl_start_server.inc
126 START SLAVE UNTIL SQL_AFTER_MTS_GAPS;
127 --let $slave_param= Until_Condition
128 --let $slave_param_value= DONE
129 --source include/wait_for_slave_param.inc
130 # there's a chance it will hang at this point (thanks to pre-exec UNTIL check)
131 --source include/wait_for_slave_sql_to_stop.inc
134 --echo ** regular restart **
135 --let $rpl_server_number= 2
136 --let $rpl_server_parameters= --
skip-slave-start --slave-transaction-retries=0 --relay-log-info-repository=
TABLE --master-info-repository=
TABLE --sync-master-info=1
138 --source include/rpl_restart_server.inc
141 #### Checking if the recovery worked and the coordinator has an updated state. ####
143 --source include/start_slave_io.inc
144 let $wait_condition=SELECT Master_log_pos = $m_before_master_pos AND Master_log_name =
"$m_before_master_file" FROM mysql.slave_master_info;
145 --source include/wait_condition.inc
148 --source include/start_slave_sql.inc
149 let $wait_condition=SELECT Master_log_pos = $m_before_master_pos AND Master_log_name =
"$m_before_master_file" FROM mysql.slave_relay_log_info;
150 --source include/wait_condition.inc
152 --source include/stop_slave.inc
153 eval SET @@global.slave_parallel_workers= $saved_current_workers;
154 eval SET @@global.slave_checkpoint_period= $saved_current_checkpoint;
157 --echo ==== end rpl_mts_crash_safe.inc:recovery ====
162 --echo ==== begin rpl_mts_crash_safe.inc:rpl_mixing_engines.inc ====
164 --source
extra/rpl_tests/rpl_mixing_engines.inc
165 --echo ==== end rpl_mts_crash_safe.inc:rpl_mixing_engines.inc ====
168 --let $commands= $rmcs_initial_commands