| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# This test verifies correctness and effectiveness of the |
| 4 |
# until-stopping when the position used is inside the Gtid_log_event |
| 5 |
# of a group (transaction) in the relaylog. |
| 6 |
# |
| 7 |
# ==== Method ==== |
| 8 |
# |
| 9 |
# The test will create a two events transaction (GTID + QUERY), and will start |
| 10 |
# the SQL thread using the UNTIL MASTER_LOG_FILE/POS clause, pointing to the |
| 11 |
# first byte of the created transaction (inside of the Gtid_log_event). |
| 12 |
# |
| 13 |
# The test expects that, after issuing the START SLAVE SQL_THREAD with the |
| 14 |
# UNTIL clause, the SQL thread will apply the created transaction (both |
| 15 |
# GTID and QUERY events) even though pointing to stop after the GTID. |
| 16 |
# The test also expects that the SQL thread will update its position |
| 17 |
# before stopping. |
| 18 |
# |
| 19 |
# The test will then verify SQL thread's binlog file, position, and |
| 20 |
# finally will wait for the SQL thread to stop. |
| 21 |
# |
| 22 |
# When the SQL thread stops, the test verifies if the second event of |
| 23 |
# the transaction (QUERY) was successfully applied. |
| 24 |
# |
| 25 |
# ==== Related bugs ==== |
| 26 |
# |
| 27 |
# Bug #18306199 START SLAVE UNTIL MASTER_LOG_POS=MIDDLE-OF-GTID-EVENT |
| 28 |
# STOPS BEFORE TRANSACTION |
| 29 |
|
| 30 |
--source include/have_binlog_format_statement.inc |
| 31 |
--source include/master-slave.inc |
| 32 |
|
| 33 |
# Stop the SQL thread |
| 34 |
--source include/rpl_connection_slave.inc |
| 35 |
--source include/stop_slave_sql.inc |
| 36 |
|
| 37 |
--echo # Saving master position to use on UNTIL clause of START SLAVE |
| 38 |
--source include/rpl_connection_master.inc |
| 39 |
--let $master_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 40 |
--let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1) |
| 41 |
--inc $master_pos |
| 42 |
|
| 43 |
# Create a table in the master (one event without GTIDS, two with GTIDS) |
| 44 |
CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
| 45 |
|
| 46 |
# Insert some data |
| 47 |
BEGIN; |
| 48 |
INSERT INTO t1 VALUES (1); |
| 49 |
COMMIT; |
| 50 |
|
| 51 |
# Sync the IO thread with the master |
| 52 |
--source include/sync_slave_io_with_master.inc |
| 53 |
|
| 54 |
# Check if SQL thread stops correctly |
| 55 |
# after executing the next event of the master binlog |
| 56 |
# based on master binlog file and position |
| 57 |
|
| 58 |
--echo # Start SQL thread until it executed the CREATE TABLE |
| 59 |
--replace_result $master_file MASTER_FILE $master_pos MASTER_POS |
| 60 |
# Disable warnings to avoid logging "UNTIL condtion is not supported ..." on MTS |
| 61 |
--disable_warnings |
| 62 |
eval START SLAVE SQL_THREAD UNTIL SOURCE_LOG_FILE = "$master_file", SOURCE_LOG_POS = $master_pos; |
| 63 |
--enable_warnings |
| 64 |
|
| 65 |
--echo # Wait until SQL thread reaches last master binlog file |
| 66 |
--let $slave_param= Relay_Master_Log_File |
| 67 |
--let $slave_param_value= $master_file |
| 68 |
--let $slave_param_comparison= = |
| 69 |
--source include/wait_for_slave_param.inc |
| 70 |
|
| 71 |
--echo # Wait until SQL thread reaches desired master binlog position |
| 72 |
--let $slave_param= Exec_Master_Log_Pos |
| 73 |
--let $slave_param_value= $master_pos |
| 74 |
--let $slave_param_comparison= >= |
| 75 |
--source include/wait_for_slave_param.inc |
| 76 |
|
| 77 |
--echo # If the desired position was reached, SQL thread should stop. |
| 78 |
--source include/wait_for_slave_sql_to_stop.inc |
| 79 |
|
| 80 |
--let $assert_cond= "[SHOW TABLES LIKE "t1"]" = "t1" |
| 81 |
--let $assert_text= t1 should be replicated |
| 82 |
--source include/assert.inc |
| 83 |
|
| 84 |
# Cleanup |
| 85 |
--source include/start_slave_sql.inc |
| 86 |
--source include/rpl_connection_master.inc |
| 87 |
DROP TABLE t1; |
| 88 |
|
| 89 |
# End of tests |
| 90 |
--source include/rpl_end.inc |