Debian Codegraph @

mysql-test/suite/group_replication/t/gr_stop_with_running_channel.test

raw
1 ################################################################################
2 # Validate Group Replication can be stopped even when replication channels are
3 # committing transactions concurrently.
4 #
5 # Test:
6 # 0. This test requires 2 servers:
7 # server1: group member
8 # server2: single server
9 # 1. Deploy a group on server1.
10 # 2. Configure a channel on server1 that replicates from
11 # server2.
12 # 3. Stop group on server1, through debug sync block the stop
13 # after acquiring `shared_plugin_stop` lock.
14 # 4. Commit a transaction on server2 which will be replicated
15 # to server1 through channel 'ch1'.
16 # Channel 'ch1' will fail since the plugin is stopping.
17 # 5. Resume STOP GROUP_REPLICATION on server1.
18 # 6. Clean up.
19 ###############################################################################
20 --source include/have_debug_sync.inc
21 --source include/have_group_replication_plugin.inc
22 --let $rpl_skip_group_replication_start= 1
23 --source include/group_replication.inc
24
25
26 --echo
27 --echo ############################################################
28 --echo # 1. Deploy a group on server1.
29 --let $rpl_connection_name= server1
30 --source include/rpl_connection.inc
31
32 SET SESSION sql_log_bin = 0;
33 call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
34 call mtr.add_suppression("Replica SQL for channel 'ch1': Worker 1 failed executing transaction.*");
35 call mtr.add_suppression("Replica SQL for channel 'ch1': ... The replica coordinator and worker threads are stopped.*");
36 call mtr.add_suppression("Replica SQL for channel 'ch1': Error 'Error on observer while running replication hook 'before_commit'.'.*");
37 call mtr.add_suppression("Replica: Error on observer while running replication hook 'before_commit'. Error_code: MY-003100");
38 SET SESSION sql_log_bin = 1;
39
40 --source include/start_and_bootstrap_group_replication.inc
41
42
43 --echo
44 --echo ############################################################
45 --echo # 2. Configure a channel on server1 that replicates from
46 --echo # server2.
47 --let $rpl_connection_name= server1
48 --source include/rpl_connection.inc
49 --replace_result $SERVER_MYPORT_2 SERVER_2_PORT
50 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_PORT=$SERVER_MYPORT_2, SOURCE_AUTO_POSITION=1 FOR CHANNEL 'ch1'
51
52 --let $rpl_channel_name='ch1'
53 --source include/start_slave.inc
54
55
56 --echo
57 --echo ############################################################
58 --echo # 3. Stop group on server1, through debug sync block the stop
59 --echo # after acquiring `shared_plugin_stop` lock.
60 --let $rpl_connection_name= server_1
61 --source include/rpl_connection.inc
62 SET @@GLOBAL.DEBUG= '+d,group_replication_hold_stop_before_leave_the_group';
63 --send STOP GROUP_REPLICATION
64
65 --let $rpl_connection_name= server1
66 --source include/rpl_connection.inc
67 SET DEBUG_SYNC='now wait_for signal.stopping_before_leave_the_group';
68
69
70 --echo
71 --echo ############################################################
72 --echo # 4. Commit a transaction on server2 which will be replicated
73 --echo # to server1 through channel 'ch1'.
74 --echo # Channel 'ch1' will fail since the plugin is stopping.
75 --let $rpl_connection_name= server2
76 --source include/rpl_connection.inc
77 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
78
79 --let $rpl_connection_name= server1
80 --source include/rpl_connection.inc
81 --let $slave_sql_errno= convert_error(ER_RUN_HOOK_ERROR)
82 --let $rpl_channel_name= 'ch1'
83 --source include/wait_for_slave_sql_error.inc
84
85
86 --echo
87 --echo ############################################################
88 --echo # 5. Resume STOP GROUP_REPLICATION on server1.
89 --let $rpl_connection_name= server1
90 --source include/rpl_connection.inc
91 SET @@GLOBAL.DEBUG= '-d,group_replication_hold_stop_before_leave_the_group';
92 SET DEBUG_SYNC='now signal signal.resume_stop_before_leave_the_group';
93
94 --let $rpl_connection_name= server_1
95 --source include/rpl_connection.inc
96 --reap
97
98 --let $rpl_connection_name= server1
99 --source include/rpl_connection.inc
100 --let $group_replication_member_state = OFFLINE
101 --source include/gr_wait_for_member_state.inc
102
103 SET DEBUG_SYNC= 'RESET';
104
105 --let $assert_text= 'There is no table t1 on server1'
106 --let $assert_cond= [SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_SCHEMA=\"test\" AND TABLE_NAME=\"t1\"] = 0
107 --source include/assert.inc
108
109
110 --echo
111 --echo ############################################################
112 --echo # 6. Clean up.
113 --let $rpl_connection_name= server1
114 --source include/rpl_connection.inc
115
116 --let $rpl_channel_name='ch1'
117 --let $rpl_multi_source= 1
118 --let $rpl_reset_slave_all= 1
119 --source include/rpl_reset_slave.inc
120 --let $rpl_channel_name=
121 --let $rpl_multi_source=
122
123 --let $rpl_connection_name= server2
124 --source include/rpl_connection.inc
125 DROP TABLE t1;
126
127 --source include/group_replication_end.inc