Debian Codegraph @

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

raw
1 ###############################################################################
2 #
3 # This test validates that transactions monitor dies if UDF fails.
4 #
5 # Test:
6 # 0. This test requires two servers
7 # 1. Start group in single primary mode.
8 # Server1 will be primary and server 2 secondary.
9 # 2. Stop the applier thread on server2.
10 # 3. Start a primary change on server1 and block the operation at validation.
11 # 4. Wait for the THD_transaction_monitor thread to start and unblock the operation.
12 # 5. Allow the primary change operation to continue.
13 # 6. Check the monitor thread exited.
14 # 7. Cleanup
15 #
16 ###############################################################################
17
18 --source include/have_debug_sync.inc
19 --source include/have_group_replication_plugin.inc
20 --let $rpl_skip_group_replication_start= 1
21 --let $rpl_group_replication_single_primary_mode=1
22 --source include/group_replication.inc
23
24 --echo
25 --echo # 1. Start group in single primary mode.
26 --echo # Server1 will be primary and server 2 secondary.
27
28 set session sql_log_bin=0;
29 call mtr.add_suppression("The function 'group_replication_set_as_primary' failed. The appointed primary for election left the group, this operation will be aborted and if present the old primary member will be re-elected. Check the group member list to see who is the primary.");
30 set session sql_log_bin=1;
31
32 SET @debug_save_m1= @@GLOBAL.DEBUG;
33 --source include/start_and_bootstrap_group_replication.inc
34
35 --let $rpl_connection_name= server2
36 --source include/rpl_connection.inc
37
38 set session sql_log_bin=0;
39 call mtr.add_suppression("There was an issue on the primary election process: Could not wait for the execution of local transactions. The member will now leave the group.");
40 call mtr.add_suppression("Plugin group_replication reported: 'A configuration change was killed in this member. The member will now leave the group as its configuration may have diverged.'");
41 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
42 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
43 call mtr.add_suppression("Error while executing a group configuration operation: A critical error occurred during the local execution of this action. The member will now leave the group.");
44 set session sql_log_bin=1;
45
46 --let $server2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
47 --source include/start_group_replication.inc
48
49 --echo
50 --echo # 2. Fake a stopped applier on server2.
51
52 --let $rpl_connection_name= server2
53 --source include/rpl_connection.inc
54
55 SET @@GLOBAL.DEBUG= '+d,group_replication_wait_for_gtid_execution_force_error';
56
57 --echo
58 --echo # 3. Start a primary change on server1 and block the operation at validation.
59
60 --let $rpl_connection_name= server1
61 --source include/rpl_connection.inc
62
63 SET @@GLOBAL.DEBUG= '+d,group_replication_block_primary_action_validation';
64
65 --replace_result $server2_uuid MEMBER2_UUID
66 --send_eval SELECT group_replication_set_as_primary("$server2_uuid",30)
67
68 --echo
69 --echo # 4. Wait for the THD_transaction_monitor thread to start and unblock the operation.
70
71 --let $rpl_connection_name= server_1
72 --source include/rpl_connection.inc
73
74 --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.threads WHERE NAME LIKE "thread/group_rpl/THD_transaction_monitor%"
75 --source include/wait_condition.inc
76
77 SET DEBUG_SYNC = "now SIGNAL signal.primary_action_continue";
78 SET @@GLOBAL.DEBUG= '-d,group_replication_block_primary_action_validation';
79
80 --echo
81 --echo # 5. Allow the primary change operation to continue.
82
83 --let $rpl_connection_name= server1
84 --source include/rpl_connection.inc
85
86 --error ER_GRP_RPL_UDF_ERROR
87 --reap
88
89 --echo
90 --echo # 6. Check the monitor thread exited.
91
92 --let $rpl_connection_name= server1
93 --source include/rpl_connection.inc
94
95 --let $wait_condition= SELECT COUNT(*)=0 FROM performance_schema.threads WHERE NAME LIKE "thread/group_rpl/THD_transaction_monitor%"
96 --source include/wait_condition.inc
97
98 --source include/gr_assert_primary_member.inc
99
100 --let $rpl_connection_name= server2
101 --source include/rpl_connection.inc
102
103 ## Note: Server1 is in ERROR state so it's primary status cannot be checked
104 --let $group_replication_member_state=ERROR
105 --source include/gr_wait_for_member_state.inc
106
107 SET @@GLOBAL.DEBUG= '-d,group_replication_wait_for_gtid_execution_force_error';
108
109 --echo
110 --echo # 7. Cleanup
111
112 --let $rpl_connection_name= server1
113 --source include/rpl_connection.inc
114
115 SET GLOBAL DEBUG= @debug_save_m1;
116
117 --let $rpl_connection_name= server2
118 --source include/rpl_connection.inc
119
120 --source include/group_replication_end.inc