Debian Codegraph @

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

raw
1 # ==== Purpose ====
2 #
3 # The purpose of this script is to test if there isn't any double-free
4 # corruption when a Rows_query_event is retried by the MTA.
5 #
6 # ==== Requirements ====
7 #
8 # R1. After a Rows_log_event is retried, the event is re-read from the
9 # relay log but the reference to the original event shouldn't be
10 # disposed during context cleanup because is further accessed.
11 #
12 # ==== Implementation ====
13 #
14 # 1. Enable `binlog_rows_query_log_events` option.
15 # 2. On the source, create a table.
16 # 3. On the source, insert a record into the table.
17 # 4. On the replica, activate a debug symbol that will force failure while
18 # applying Rows_query_event 3 times.
19 # 5. On the replica, wait for a debug sync signal that notifies that the
20 # Rows_query_event was sucessfully applied.
21 # 6. On the replica, remove the debug point and sync with the source.
22 # 7. Clean up.
23 #
24 # ==== References ====
25 #
26 # BUG#32590974 MTS: SEGFAULT OR HEAP-USE-AFTER-FREE IN
27 # SLAVE_WORKER_EXEC_JOB_GROUP
28 #
29
30 --source include/have_debug_sync.inc
31 --source include/have_binlog_format_row.inc
32 --source include/only_mts_replica_parallel_workers.inc
33 --let $option_name = replica_transaction_retries
34 --let $option_operator = >
35 --let $option_value = 2
36 --source include/only_with_option.inc
37 --source include/master-slave.inc
38
39 # 1. Enable `binlog_rows_query_log_events` option.
40 --let $saved_binlog_rows_query_log_events = `SELECT @@SESSION.binlog_rows_query_log_events`
41 SET SESSION binlog_rows_query_log_events = ON;
42
43 # 2. On the source, create a table.
44 CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX(c2)) ENGINE = InnoDB;
45 --source include/sync_slave_sql_with_master.inc
46 --source include/stop_slave.inc
47
48 # 3. On the source, insert a record into the table.
49 --source include/rpl_connection_master.inc
50 INSERT INTO t1 VALUES (0, 0);
51
52 # 4. On the replica, activate a debug symbol that will force failure while
53 # applying Rows_query_event 3 times.
54 --source include/rpl_connection_slave.inc
55 --let $debug_point = error_on_rows_query_event_apply
56 --source include/add_debug_point.inc
57 --source include/start_slave.inc
58
59 # 5. On the replica, wait for a debug sync signal that notifies that the
60 # Rows_query_event was sucessfully applied.
61 SET DEBUG_SYNC = "now WAIT_FOR end_retries_on_rows_query_event_apply";
62
63 # 6. On the replica, remove the debug point and sync with the source.
64 --source include/rpl_connection_master.inc
65 --source include/sync_slave_sql_with_master.inc
66 --let $debug_point = error_on_rows_query_event_apply
67 --source include/remove_debug_point.inc
68
69 # 7. Clean up.
70 --source include/rpl_connection_master.inc
71 DROP TABLE t1;
72 --replace_result $saved_binlog_rows_query_log_events BINLOG_ROWS_QUERY_LOG_EVENTS
73 --eval SET SESSION binlog_rows_query_log_events = $saved_binlog_rows_query_log_events
74 --source include/rpl_end.inc