Debian Codegraph @

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

raw
1 ###############################################################################
2 #
3 # STOP GROUP_REPLICATION will signal group coordination process and loop until
4 # all UDF terminate.
5 #
6 # Test:
7 # 0. This test requires two servers on multi primary mode
8 # 1. Activate debug point will block action after verify plugin isn't
9 # stopping
10 # 2. Start action switch to single primary mode
11 # 3. Wait for action hit the debug point
12 # 4. STOP Group Replication on server1
13 # 5. Wait for member state is OFFLINE
14 # 6. To improve test but without adding more debug code, sleep to allow
15 # STOP Group Replication loop until UDF function finishes
16 # 7. Assert STOP GROUP_REPLICATION thread still runs
17 # 8. Signal the action to continue
18 # 9. Reap execution of action and confirm it failed
19 # 10. Reap with success the execution of STOP GROUP_REPLICATION
20 # 11. Cleanup
21 #
22 ###############################################################################
23
24 --source include/have_debug_sync.inc
25 --source include/have_group_replication_plugin.inc
26 --let $rpl_server_count= 2
27 --source include/group_replication.inc
28
29 --echo
30 --echo # 1. Activate debug point will block action after verify plugin isn't
31 --echo # stopping
32
33 --let $rpl_connection_name= server1
34 --source include/rpl_connection.inc
35
36 set session sql_log_bin=0;
37 call mtr.add_suppression("The function 'group_replication_switch_to_single_primary_mode' failed. The group coordination process is terminating.");
38 set session sql_log_bin=1;
39
40 --let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
41
42 SET @debug_saved = @@GLOBAL.DEBUG;
43 SET @@GLOBAL.DEBUG='+d,group_replication_hold_udf_after_plugin_is_stopping';
44
45 --echo
46 --echo # 2. Start action switch to single primary mode
47
48 --replace_result $server1_uuid MEMBER1_UUID
49 --send_eval SELECT group_replication_switch_to_single_primary_mode("$server1_uuid")
50
51 --echo
52 --echo # 3. Wait for action hit the debug point
53
54 --let $rpl_connection_name= server_1_1
55 --source include/rpl_connection.inc
56
57 SET DEBUG_SYNC= "now WAIT_FOR signal.group_replication_resume_udf";
58
59 --echo
60 --echo # 4. STOP Group Replication on server1
61
62 --send STOP GROUP_REPLICATION;
63
64 --let $rpl_connection_name= server_1
65 --source include/rpl_connection.inc
66
67 --echo
68 --echo # 5. Wait for member state is OFFLINE
69
70 --let $group_replication_member_state= OFFLINE
71 --source include/gr_wait_for_member_state.inc
72
73 --echo
74 --echo # 6. To improve test but without adding more debug code, sleep to allow
75 --echo # STOP Group Replication loop until UDF function finishes
76
77 --sleep 2
78
79 --echo
80 --echo # 7. Assert STOP GROUP_REPLICATION thread still runs
81
82 --let $assert_text= 'There is a thread executing STOP GROUP_REPLICATION on server1'
83 --let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.threads WHERE processlist_INFO LIKE "STOP GROUP_REPLICATION", count, 1] = 1
84 --source include/assert.inc
85
86 --echo
87 --echo # 8. Signal the action to continue
88
89 SET DEBUG_SYNC = "now SIGNAL signal.group_replication_resume_udf_continue";
90
91 --echo
92 --echo # 9. Reap execution of action and confirm it failed
93
94 --let $rpl_connection_name= server1
95 --source include/rpl_connection.inc
96
97 --replace_result $server1_uuid MEMBER1_UUID
98 --error ER_CANT_INITIALIZE_UDF
99 --reap
100
101 --echo
102 --echo # 10. Reap with success the execution of STOP GROUP_REPLICATION
103
104 --let $rpl_connection_name= server_1_1
105 --source include/rpl_connection.inc
106
107 --reap
108
109 --echo
110 --echo # 11. Cleanup
111
112 SET @@GLOBAL.DEBUG= @debug_save;
113
114 --let $rpl_group_replication_single_primary_mode=1
115 --let $rpl_group_replication_reset_persistent_vars=1
116 --source include/group_replication_end.inc