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