Debian Codegraph @

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

raw
1 ###############################################################################
2 #
3 # This test validates transactions monitor dies if client disconnects post
4 # executing UDF or when UDF errors out.
5 # KILL query is blocked so testing of KILL connection cannot be done.
6 #
7 # Test:
8 # 0. This test requires two servers
9 # 1. Start group in single primary mode.
10 # Server1 will be primary and server 2 secondary.
11 # 2. Add a debug point to block the primary change on validation.
12 # 3. Start a primary change on server 1 using connection client_disconnect
13 # 4. Wait for the THD_transaction_monitor thread to start.
14 # 5. Disconnect the client_disconnect connection.
15 # And signal the operation to run.
16 # 6. Check the monitor thread exited.
17 # 7. Cleanup
18 #
19 ###############################################################################
20
21 # Client Connection is being disconnected hence the force restart option
22 --source include/force_restart.inc
23 --source include/have_debug_sync.inc
24 --source include/have_group_replication_plugin.inc
25 --let $rpl_skip_group_replication_start= 1
26 --let $rpl_group_replication_single_primary_mode=1
27 --source include/group_replication.inc
28
29 --echo
30 --echo # 1. Start group in single primary mode.
31 --echo # Server1 will be primary and server 2 secondary.
32
33 --source include/start_and_bootstrap_group_replication.inc
34
35 --let $rpl_connection_name= server2
36 --source include/rpl_connection.inc
37
38 --let $server2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
39 --source include/start_group_replication.inc
40
41 --echo
42 --echo # 2. Add a debug point to block the primary change on validation.
43
44 --let $rpl_connection_name= server1
45 --source include/rpl_connection.inc
46
47 SET @@GLOBAL.DEBUG= '+d,group_replication_block_primary_action_validation';
48
49 --echo
50 --echo # 3. Start a primary change on server 1 using connection client_disconnect
51
52 --connect(client_disconnect, localhost,root,,,$MASTER_MYPORT)
53
54 --let $rpl_connection_name= client_disconnect
55 --source include/rpl_connection.inc
56
57 --replace_result $server2_uuid MEMBER2_UUID
58 --send_eval SELECT group_replication_set_as_primary("$server2_uuid", 60)
59
60 --echo
61 --echo # 4. Wait for the THD_transaction_monitor thread to start.
62
63 --let $rpl_connection_name= server1
64 --source include/rpl_connection.inc
65
66 --let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.threads WHERE NAME LIKE "thread/group_rpl/THD_transaction_monitor%"
67 --source include/wait_condition.inc
68
69 --echo
70 --echo # 5. Disconnect the client_disconnect connection.
71 --echo # And signal the operation to run.
72
73 --disconnect client_disconnect
74 SET DEBUG_SYNC = "now SIGNAL signal.primary_action_continue";
75 SET @@GLOBAL.DEBUG= '-d,group_replication_block_primary_action_validation';
76
77 --echo
78 --echo # 6. Check the monitor thread exited.
79
80 --let $rpl_connection_name= server1
81 --source include/rpl_connection.inc
82
83 --let $wait_condition= SELECT COUNT(*)=0 FROM performance_schema.threads WHERE NAME LIKE "thread/group_rpl/THD_transaction_monitor%"
84 --source include/wait_condition.inc
85
86 --source include/gr_assert_secondary_member.inc
87
88 --let $rpl_connection_name= server2
89 --source include/rpl_connection.inc
90
91 --source include/gr_assert_primary_member.inc
92
93
94 --echo
95 --echo # 7. Cleanup
96
97 --source include/group_replication_end.inc