Debian Codegraph @

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

raw
1 # ==== PURPOSE ====
2 #
3 # This test validates handling of the relay_log_space_limit by replication
4 # threads: receiver and applier coordinator. Here, we test basic functionality
5 # of the 'relay_log_space_limit' and also check that:
6 # - there is no race between receiver and coordinator when handling the limit
7 #
8 # ==== REQUIREMENTS ====
9 #
10 # relay_log_space_limit requirements:
11 #
12 # R1. When transaction size is lower than the 'relay_log_space_limit', the
13 # replica shall use the maximum of the 'relay_log_space_limit' bytes to
14 # store transactions in the relay log.
15 # R2. When receiver writes transaction into the relay log, when the used
16 # relay log space plus the
17 # transaction size exceed the 'relay_log_space_limit', the receiver
18 # shall rotate the relay log and wait for notification that relay log
19 # space was reclaimed by the coordinator.
20 # R3. When the applier coordinator detects that the replica receiver is waiting,
21 # when outside of a group, the coordinator shall:
22 # a) wait for workers to apply scheduled jobs
23 # b) force purging the current relay log file before moving to the next file
24 # c) notify the receiver that a part of relay log space used was reclaimed
25 # R4. When transaction size is higher than the 'relay_log_space_limit', when all
26 # possible relay log files are purged, the replica shall ignore the limit
27 # and write the transaction into the relay log.
28 #
29 # test requirements:
30 #
31 # R1. When transaction size is higher than the 'relay_log_space_limit', when all
32 # possible relay log files are purged, the replica shall ignore the limit
33 # and write the transaction into the relay log.
34 #
35 # ==== IMPLEMENTATION ====
36 #
37 # T1.
38 # Test steps:
39 #
40 # 0. Test setup:
41 # a) the 'relay_log_space_limit' is able to fit all transactions except
42 # of the last, large transaction
43 # 1. Start the receiver
44 # 2. Create a table
45 # 3. Generate 2 small transactions, rotate relay log after each
46 # transaction
47 # 4. Generate a transaction that exceeds the relay log space limit, which
48 # will block the receiver
49 # 5. Run replication applier
50 # 6. Synchronize source and replica servers
51 # 7. Execute a transaction that cannot fit into the relay log space
52 # limit. After purging relay log, the limit is ignored.
53 # 8. Synchronize source and replica servers
54 # 9. Check Pass condition 2: test finished (no deadlock), checked
55 # automatically
56 #
57 # Test pass conditions:
58 #
59 # - step 9 (synchronization in step 6 and step 8 succeeds)
60 #
61 # ==== REFERENCES ====
62 #
63 # Bug#36507020 relay_log_space_limit GTID and large txns may lead
64 # to no channel progress
65 #
66
67 --source include/big_test.inc
68
69 --source include/have_binlog_format_row.inc
70
71 --let $rpl_skip_start_slave=1
72 --source include/master-slave.inc
73
74 --echo
75 --echo # 1. Start the receiver
76 --echo
77
78 --source include/rpl_connection_slave.inc
79 --source include/start_slave_io.inc
80
81 --echo
82 --echo # 2. Create a table
83 --echo # 3. Generate 2 small transactions, rotate relay log after each
84 --echo # transaction
85 --echo
86
87 --source include/rpl_connection_master.inc
88 CREATE TABLE t (a LONGBLOB) ENGINE = InnoDB;
89 INSERT INTO t VALUES (REPEAT('a', 1000));
90 --source include/sync_slave_io_with_master.inc
91 FLUSH RELAY LOGS;
92 --source include/rpl_connection_master.inc
93 INSERT INTO t VALUES (REPEAT('a', 1000));
94 --source include/sync_slave_io_with_master.inc
95 FLUSH RELAY LOGS;
96
97 --echo
98 --echo # 4. Generate a transaction that exceeds the relay log space limit, which
99 --echo # will block the receiver
100 --echo
101
102 --source include/rpl_connection_master.inc
103 INSERT INTO t VALUES (REPEAT('a', 10000));
104
105 --echo
106 --echo # 5. Run replication applier
107 --echo
108
109 --source include/rpl_connection_slave.inc
110 --let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.threads WHERE name='thread/sql/replica_io' AND processlist_state= 'Waiting for the replica SQL thread to free relay log space'
111 --source include/wait_condition.inc
112 --source include/start_slave_sql.inc
113
114 --echo
115 --echo # 6. Synchronize source and replica servers
116 --echo
117
118 --source include/rpl_connection_master.inc
119 --source include/sync_slave_sql_with_master.inc
120
121 --echo
122 --echo # 7. Execute a transaction that cannot fit into the relay log space
123 --echo # limit. After purging relay log, the limit is ignored.
124 --echo
125
126 --source include/rpl_connection_master.inc
127 INSERT INTO t VALUES (REPEAT('a', 15000));
128
129 --echo
130 --echo # 8. Synchronize source and replica servers
131 --echo
132
133 --source include/sync_slave_sql_with_master.inc
134
135 --echo
136 --echo # Clean up
137 --echo
138
139 --source include/rpl_connection_master.inc
140 DROP TABLE t;
141 --source include/rpl_end.inc