| 1 |
############################################################################### |
| 2 |
# Bug#27368735 BINLOG NAME AND POS ARE WRONG IN GROUP_REPLICATION_APPLIER |
| 3 |
# CHANNEL'S ERROR MSGS |
| 4 |
# Problem: When group_replication_applier channel's applier thread is facing |
| 5 |
# an error, master_log_name and end_log_pos in the error message |
| 6 |
# are incorrect. |
| 7 |
# |
| 8 |
# Steps to reproduce: |
| 9 |
# =================== |
| 10 |
# 0) Test require two servers in the group |
| 11 |
# 1) Create a table with a primary key on both servers. |
| 12 |
# 2) Have a tuple with key '1' on server2. |
| 13 |
# 3) Insert the same tuple on server1 and try to sync on server2. |
| 14 |
# 4) Sync (applier thread on server2) will fail because of |
| 15 |
# the duplicate key error. |
| 16 |
# 5) Check that the error says master_log_name and end_log_pos as <unknown> |
| 17 |
# instead of displaying wrong values. |
| 18 |
# 6) Cleanup (drop table on both servers) |
| 19 |
############################################################################### |
| 20 |
--source include/only_mts_replica_parallel_workers.inc |
| 21 |
--source include/have_group_replication_plugin.inc |
| 22 |
--source include/group_replication.inc |
| 23 |
|
| 24 |
--echo # |
| 25 |
--echo # Step-1: Initial setup (create table on both servers) |
| 26 |
--echo # |
| 27 |
--let $rpl_connection_name= server_1 |
| 28 |
--source include/rpl_connection.inc |
| 29 |
CREATE TABLE t1(i INT PRIMARY KEY); |
| 30 |
--source include/rpl_sync.inc |
| 31 |
|
| 32 |
--echo # |
| 33 |
--echo # Step-2: Insert a tuple on server2 directly without writing |
| 34 |
--echo # into binlog. |
| 35 |
--echo # |
| 36 |
--let $rpl_connection_name= server_2 |
| 37 |
--source include/rpl_connection.inc |
| 38 |
SET sql_log_bin=0; |
| 39 |
INSERT INTO t1 values (1); |
| 40 |
|
| 41 |
--echo # |
| 42 |
--echo # Step-3: Add error suppressions which are required |
| 43 |
--echo # for the test to pass. |
| 44 |
--echo # |
| 45 |
CALL mtr.add_suppression("Could not execute Write_rows event on table test.t1"); |
| 46 |
CALL mtr.add_suppression("The applier thread execution was aborted. Unable to process more transactions, this member will now leave the group."); |
| 47 |
CALL mtr.add_suppression("Fatal error during execution on the Applier process of Group Replication. The server will now leave the group."); |
| 48 |
CALL mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 49 |
CALL mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); |
| 50 |
CALL mtr.add_suppression("The replica coordinator and worker threads are stopped"); |
| 51 |
SET sql_log_bin=1; |
| 52 |
|
| 53 |
--echo # |
| 54 |
--echo # Step-4: Insert a tuple on server1 |
| 55 |
--echo # |
| 56 |
--let $rpl_connection_name= server_1 |
| 57 |
--source include/rpl_connection.inc |
| 58 |
INSERT INTO t1 VALUES (1); |
| 59 |
|
| 60 |
--echo # |
| 61 |
--echo # Step-5: sync will fail because the same tuple exists on server2 |
| 62 |
--echo # (insert on server2 at step-2). |
| 63 |
--echo # |
| 64 |
--let $rpl_connection_name= server_2 |
| 65 |
--source include/rpl_connection.inc |
| 66 |
--let $group_replication_member_state= ERROR |
| 67 |
--source include/gr_wait_for_member_state.inc |
| 68 |
|
| 69 |
--echo # |
| 70 |
--echo # Step-6: Grep for the expected error in server log. |
| 71 |
--echo # |
| 72 |
--let $assert_file= $MYSQLTEST_VARDIR/tmp/gr_applier_error.2.err |
| 73 |
--let $assert_count = 1 |
| 74 |
--let $assert_select = failed executing transaction '.*'; Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 't1.PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY, Error_code: MY-001062 |
| 75 |
--let $assert_text = Found the expected error in group_replication_applier channel. |
| 76 |
--source include/assert_grep.inc |
| 77 |
|
| 78 |
--echo # |
| 79 |
--echo # Step-7: Cleanup (drop table on both servers) |
| 80 |
--echo # |
| 81 |
--let $rpl_connection_name= server_1 |
| 82 |
--source include/rpl_connection.inc |
| 83 |
DROP TABLE t1; |
| 84 |
|
| 85 |
--echo # Step-7.2: Server_2 entered into 'read_only' mode due to the above error. |
| 86 |
--echo # Sync the above 'drop table' wont work. |
| 87 |
--echo # Reset the slave and 'DROP' the table manually. |
| 88 |
--let $rpl_connection_name= server_2 |
| 89 |
--source include/rpl_connection.inc |
| 90 |
--source include/stop_group_replication.inc |
| 91 |
RESET SLAVE ALL FOR CHANNEL "group_replication_applier"; |
| 92 |
DROP TABLE t1; |
| 93 |
--source include/group_replication_end.inc |