Debian Codegraph @

mysql-test/suite/rpl_nogtid/t/rpl_parallel_worker_error.test

raw
1 # Inorder to grep a specific error pattern in error log a fresh error log
2 # needs to be generated.
3 --source include/force_restart.inc
4 --source include/have_binlog_format_statement.inc
5 --source include/only_mts_replica_parallel_workers.inc
6 --source include/master-slave.inc
7
8 #
9 # Proving correct error reporting by Worker in condition of the failing query
10 # size is close to that of internal buffer MAX_SLAVE_ERRMSG.
11 # bug#18563480 MTS: CRASH WHEN SLAVE WORKER TRY TO EXECUTE A BIG STATEMENT doomed to fail
12 #
13
14 # Create a table on the slave to set up future error on its creation
15 # via replication
16
17 --connection slave
18 call mtr.add_suppression("Replica SQL for channel '': Worker.*failed executing transaction");
19 call mtr.add_suppression("Replica SQL for channel '':.*The replica coordinator and worker threads are stopped");
20
21 --eval CREATE TABLE t (a TEXT) select "a" as a
22
23 # Create a query size of over MAX_SLAVE_ERRMSG = 1024
24
25 --connection master
26
27 --let i=0
28 --let select_arg=a
29
30 while ($i < 1024)
31 {
32 --inc $i
33 --let $select_arg=a$select_arg
34 }
35
36 --eval CREATE TABLE t (a TEXT) select "$select_arg" as a
37
38 --connection slave
39
40 # Error is found as expected.
41 --let $slave_sql_errno= convert_error(ER_TABLE_EXISTS_ERROR)
42 --source include/wait_for_slave_sql_error.inc
43
44 # The next assertion is related to:
45 # BUG#25231367: INCONSISTENT WORKER_ID BETWEEN RPL P_S TABLES AND MTS ERROR
46 # MESSAGES
47 # It checks if the WORKER_ID of the worker reporting the failure in the
48 # replication_applier_status_by_worker table is the same informed in the
49 # reported error message.
50 --let $ps_from_clause= FROM performance_schema.replication_applier_status_by_worker WHERE LAST_ERROR_NUMBER <> 0
51 --let $ps_worker_id= `SELECT CONCAT("Worker ", WORKER_ID) $ps_from_clause`
52 --let $msg_worker_id= `SELECT LEFT(LAST_ERROR_MESSAGE, LENGTH("$ps_worker_id")) $ps_from_clause`
53 --let $assert_text= Error message should report same worker ID as WORKER_ID field in P_S tables
54 --let $assert_cond= "$ps_worker_id" = "$msg_worker_id"
55 --source include/assert.inc
56
57 # Remove slave side table, recover slave to catch up
58 DROP TABLE t;
59 --source include/start_slave_sql.inc
60
61 --connection master
62 --source include/sync_slave_sql_with_master.inc
63
64
65 #
66 # Cleanup
67 #
68
69 --connection master
70 DROP TABLE t;
71 --source include/sync_slave_sql_with_master.inc
72
73 # Bug#21198611: MULTI-THREADED SLAVE LOG SPAMMING ON FAILURE
74 # When a multi-threaded slave stops with an error, the same error message is
75 # printed three times.
76
77 # Steps that are executed above ensure that MTS slave stops with an error.
78 # Following lines check that "The slave coordinator and worker threads are
79 # stopped..." error message is printed only once in the error log.
80
81 --let $expected_errno= convert_error(ER_MTA_INCONSISTENT_DATA)
82 --let $expected_errno= MY-00$expected_errno
83 --replace_regex /[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][-+Z][0-9:]* *[0-9]* \[Warning\] \[[^[]+\] */DATE_TIME [Warning] /
84 --replace_result $expected_errno ER_MTA_INCONSISTENT_DATA
85 --let GREP_FILE=$MYSQLTEST_VARDIR/tmp/slave.err
86 --let GREP_PATTERN=The replica coordinator and worker threads are stopped
87 --source include/grep_pattern.inc
88
89 --source include/rpl_end.inc