Debian Codegraph @

mysql-test/suite/rpl/t/rpl_row_slave_skip_error_all.test

raw
1 # ==== Purpose ====
2 #
3 # Check that replica-skip-errors skips following errors like
4 # ER_REPLICA_CONVERSION_FAILED and ER_NO_SUCH_TABLE.
5 #
6 # ==== Implementation ====
7 # On slave, set replica_skip_errors=all, so that slave skips all the errors that
8 # are reported during application of row based events.
9 #
10 # On master, create a table t with a varchar filed of length 25. On slave
11 # increase the varchar field width to 255, so that updates that are received
12 # from master will fail on slave with error ER_REPLICA_CONVERSION_FAILED.
13 #
14 # Secondly drop the table t on slave and try to the update the table from
15 # master. The updates will fail on slave with an error ER_NO_SUCH_TABLE.
16 #
17 # Verify that slave doesn't break inspite of these errors.
18 # ==== References ====
19 #
20 # Bug#17653275:--REPLICA-SKIP-ERRORS WON'T SKIP MISSING DATABASE/TABLE
21 ################################################################################
22 --source include/have_debug.inc
23 --source include/have_binlog_format_row.inc
24 --source include/master-slave.inc
25
26 # On master create table t which contains a field named 'name' with length
27 # varchar(25).
28 CREATE TABLE t (name VARCHAR(25) DEFAULT NULL) ENGINE=InnoDB;
29 --source include/sync_slave_sql_with_master.inc
30
31 # On slave alter the name field length to varchar(255).
32 call mtr.add_suppression("Replica SQL.*Error executing row event: .Table .test.t. doesn.t exist., Error_code: MY-001146");
33 call mtr.add_suppression("Replica SQL.*Column 0 of table .test.t. cannot be converted from type.* Error_code: MY-013146");
34 call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
35 call mtr.add_suppression("Got error 149 - .Lock deadlock; Retry transaction. during COMMIT");
36 ALTER TABLE t CHANGE name name VARCHAR(255);
37
38 --source include/rpl_connection_master.inc
39 INSERT INTO t VALUE ('Amy');
40 --echo # Sync should be successful. Slave should not stop with an error
41 --echo # ER_REPLICA_CONVERSION_FAILED. It should be up and running in spite
42 --echo # of errors as we have set slave_skip_error=all.
43 --source include/sync_slave_sql_with_master.inc
44
45 # Drop the table t on slave.
46 DROP TABLE t;
47
48 --source include/rpl_connection_master.inc
49 UPDATE t SET name='New';
50 --echo # Sync should be successful. Slave should not stop with an error
51 --echo # ER_NO_SUCH_TABLE. It should be up and running in spite of errors
52 --echo # as we have set slave_skip_error=all.
53 --source include/sync_slave_sql_with_master.inc
54
55 --echo # Enable a debug point to simulate failure during rows event cleanup.
56
57 --let $debug_point= simulate_rows_event_cleanup_failure
58 --source include/add_debug_point.inc
59
60 --source include/rpl_connection_master.inc
61 UPDATE t SET name='Old';
62 --source include/rpl_connection_slave.inc
63 --echo # Since this is not an ignored error slave should stop. We only ignore the
64 --echo # errors that are generated during the execution of an event. The other errors
65 --echo # that are generated during commit/rollback failure, which takes place during cleanup
66 --echo # cannot be ignored.
67 --let $slave_sql_errno= convert_error(ER_ERROR_DURING_COMMIT);
68 --source include/wait_for_slave_sql_error.inc
69
70 # Verfiy that two warning logs for 'Error executing row event: ' (due to executing
71 # two update statement to table t on master after dropping the table t at slave) are logged
72 # in the error log of slave.
73 --let $assert_text = Found 2 warning in the error log
74 --let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err
75 --let $assert_select = Replica SQL.*Error executing row event: .Table .test.t. doesn.t exist., Error_code: MY-001146
76 --let $assert_count = 2
77 --source include/assert_grep.inc
78
79 --echo ==== Clean up ====
80
81 --let $debug_point= simulate_rows_event_cleanup_failure
82 --source include/remove_debug_point.inc
83
84 --source include/stop_slave_io.inc
85 RESET MASTER;
86 RESET SLAVE;
87 --source include/start_slave.inc
88
89 --source include/rpl_connection_master.inc
90 --source include/sync_slave_sql_with_master.inc
91
92 --source include/rpl_connection_master.inc
93 DROP TABLE t;
94 --source include/rpl_end.inc