|
| 1 | +include/master-slave.inc |
| 2 | +[connection master] |
| 3 | +# |
| 4 | +# Set up |
| 5 | +# |
| 6 | +connection master; |
| 7 | +SET STATEMENT sql_log_bin=0 FOR CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format"); |
| 8 | +SET STATEMENT sql_log_bin=0 FOR CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format"); |
| 9 | +connection slave; |
| 10 | +SET STATEMENT sql_log_bin=0 FOR CALL mtr.add_suppression("Slave log event execution was interrupted"); |
| 11 | +SET STATEMENT sql_log_bin=0 FOR CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format"); |
| 12 | +SET @save_slave_max_statement_time=@@GLOBAL.slave_max_statement_time; |
| 13 | +# |
| 14 | +# Test Case 1) Using a serial slave, the SQL thread should time out when |
| 15 | +# its underlying event executes for longer than @@slave_max_statement_time. |
| 16 | +# |
| 17 | +connection master; |
| 18 | +create table t1(a int not null auto_increment, b int, primary key(a)) engine=InnoDB; |
| 19 | +include/save_master_gtid.inc |
| 20 | +connection slave; |
| 21 | +include/sync_with_master_gtid.inc |
| 22 | +include/stop_slave.inc |
| 23 | +SET @old_slave_max_statement_time=@@GLOBAL.slave_max_statement_time; |
| 24 | +SET GLOBAL slave_max_statement_time=0.75; |
| 25 | +connection master; |
| 26 | +# Long running command due to a lock conflict |
| 27 | +INSERT INTO t1(b) VALUES (1); |
| 28 | +include/save_master_gtid.inc |
| 29 | +connection slave1; |
| 30 | +BEGIN; |
| 31 | +INSERT INTO t1(b) VALUES (1); |
| 32 | +connection slave; |
| 33 | +# Starting slave to receive event which will take longer to execute |
| 34 | +# than slave_max_statement_time |
| 35 | +START SLAVE; |
| 36 | +include/wait_for_slave_sql_error.inc [errno=4192] |
| 37 | +# Ensuring event was not processed.. |
| 38 | +# ..success |
| 39 | +# Remove slave timeout and catch up to master |
| 40 | +SET GLOBAL slave_max_statement_time=0; |
| 41 | +connection slave1; |
| 42 | +ROLLBACK; |
| 43 | +include/start_slave.inc |
| 44 | +include/sync_with_master_gtid.inc |
| 45 | +# Test case cleanup |
| 46 | +connection master; |
| 47 | +DROP TABLE t1; |
| 48 | +include/save_master_gtid.inc |
| 49 | +connection slave; |
| 50 | +include/sync_with_master_gtid.inc |
| 51 | +include/stop_slave.inc |
| 52 | +SET GLOBAL slave_max_statement_time=@old_slave_max_statement_time; |
| 53 | +include/start_slave.inc |
| 54 | +# |
| 55 | +# Test Case 2) Using a parallel slave, a worker thread should time out |
| 56 | +# when its underlying event executes for longer than |
| 57 | +# @@slave_max_statement_time |
| 58 | +# |
| 59 | +include/stop_slave.inc |
| 60 | +SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; |
| 61 | +SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode; |
| 62 | +SET GLOBAL slave_parallel_threads=2; |
| 63 | +SET GLOBAL slave_parallel_mode='optimistic'; |
| 64 | +include/start_slave.inc |
| 65 | +connection master; |
| 66 | +create table t1(a int not null auto_increment, b int, primary key(a)) engine=InnoDB; |
| 67 | +include/save_master_gtid.inc |
| 68 | +connection slave; |
| 69 | +include/sync_with_master_gtid.inc |
| 70 | +include/stop_slave.inc |
| 71 | +SET @old_slave_max_statement_time=@@GLOBAL.slave_max_statement_time; |
| 72 | +SET GLOBAL slave_max_statement_time=0.75; |
| 73 | +connection master; |
| 74 | +# Long running command due to a lock conflict |
| 75 | +INSERT INTO t1(b) VALUES (1); |
| 76 | +include/save_master_gtid.inc |
| 77 | +connection slave1; |
| 78 | +BEGIN; |
| 79 | +INSERT INTO t1(b) VALUES (1); |
| 80 | +connection slave; |
| 81 | +# Starting slave to receive event which will take longer to execute |
| 82 | +# than slave_max_statement_time |
| 83 | +START SLAVE; |
| 84 | +include/wait_for_slave_sql_error.inc [errno=4192] |
| 85 | +# Ensuring event was not processed.. |
| 86 | +# ..success |
| 87 | +# Remove slave timeout and catch up to master |
| 88 | +SET GLOBAL slave_max_statement_time=0; |
| 89 | +connection slave1; |
| 90 | +ROLLBACK; |
| 91 | +include/start_slave.inc |
| 92 | +include/sync_with_master_gtid.inc |
| 93 | +# Test case cleanup |
| 94 | +connection master; |
| 95 | +DROP TABLE t1; |
| 96 | +include/save_master_gtid.inc |
| 97 | +connection slave; |
| 98 | +include/sync_with_master_gtid.inc |
| 99 | +include/stop_slave.inc |
| 100 | +SET GLOBAL slave_max_statement_time=@old_slave_max_statement_time; |
| 101 | +include/start_slave.inc |
| 102 | +include/stop_slave.inc |
| 103 | +SET GLOBAL slave_parallel_mode=@old_parallel_mode; |
| 104 | +SET GLOBAL slave_parallel_threads=@old_parallel_threads; |
| 105 | +include/start_slave.inc |
| 106 | +# |
| 107 | +# Test Case 3) Load-based log events (from LOAD DATA INFILE) should time |
| 108 | +# out if their execution time exceeds @@slave_max_statement_time |
| 109 | +# |
| 110 | +connection master; |
| 111 | +create table t1(a int not null auto_increment, b int, primary key(a)) engine=InnoDB; |
| 112 | +include/save_master_gtid.inc |
| 113 | +connection slave; |
| 114 | +include/sync_with_master_gtid.inc |
| 115 | +include/stop_slave.inc |
| 116 | +SET @old_slave_max_statement_time=@@GLOBAL.slave_max_statement_time; |
| 117 | +SET GLOBAL slave_max_statement_time=0.75; |
| 118 | +connection master; |
| 119 | +# Long running command due to a lock conflict |
| 120 | +load data infile '../../std_data/rpl_loaddata.dat' into table t1; |
| 121 | +include/save_master_gtid.inc |
| 122 | +connection slave1; |
| 123 | +BEGIN; |
| 124 | +INSERT INTO t1(b) VALUES (1); |
| 125 | +connection slave; |
| 126 | +# Starting slave to receive event which will take longer to execute |
| 127 | +# than slave_max_statement_time |
| 128 | +START SLAVE; |
| 129 | +include/wait_for_slave_sql_error.inc [errno=4192] |
| 130 | +# Ensuring event was not processed.. |
| 131 | +# ..success |
| 132 | +# Remove slave timeout and catch up to master |
| 133 | +SET GLOBAL slave_max_statement_time=0; |
| 134 | +connection slave1; |
| 135 | +ROLLBACK; |
| 136 | +include/start_slave.inc |
| 137 | +include/sync_with_master_gtid.inc |
| 138 | +# Test case cleanup |
| 139 | +connection master; |
| 140 | +DROP TABLE t1; |
| 141 | +include/save_master_gtid.inc |
| 142 | +connection slave; |
| 143 | +include/sync_with_master_gtid.inc |
| 144 | +include/stop_slave.inc |
| 145 | +SET GLOBAL slave_max_statement_time=@old_slave_max_statement_time; |
| 146 | +include/start_slave.inc |
| 147 | +# |
| 148 | +# Test Case 4) Locally executed long running statements should not time |
| 149 | +# out due to @@slave_max_statement_time |
| 150 | +# |
| 151 | +connection slave; |
| 152 | +include/stop_slave.inc |
| 153 | +SET @old_slave_max_statement_time=@@GLOBAL.slave_max_statement_time; |
| 154 | +SET @old_gtid_domain_id=@@GLOBAL.gtid_domain_id; |
| 155 | +SET @@GLOBAL.slave_max_statement_time=0.75; |
| 156 | +SET @@GLOBAL.gtid_domain_id=1; |
| 157 | +include/start_slave.inc |
| 158 | +CREATE TABLE t2 (a int); |
| 159 | +SET STATEMENT sql_log_bin=0 FOR INSERT INTO t2 SELECT SLEEP(1); |
| 160 | +DROP TABLE t2; |
| 161 | +include/stop_slave.inc |
| 162 | +SET GLOBAL gtid_domain_id=@old_gtid_domain_id; |
| 163 | +SET GLOBAL slave_max_statement_time=@old_slave_max_statement_time; |
| 164 | +include/start_slave.inc |
| 165 | +# Cleanup |
| 166 | +include/stop_slave.inc |
| 167 | +SET GLOBAL slave_max_statement_time=@save_slave_max_statement_time; |
| 168 | +include/start_slave.inc |
| 169 | +include/rpl_end.inc |
| 170 | +# End of rpl_slave_max_statement_time.test |
0 commit comments