File: gr_primary_mode_group_operations_16.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (130 lines) | stat: -rw-r--r-- 4,962 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
###############################################################################
#
# When a configuration change involving primary election is
# running no slave channels can be start in the group members.
#
# Test:
#   0. This test need 3 servers
#   1. server1 start group replication and server2 join
#   2. Activate debug point that will block the group action when changing
#      to single primary mode
#   3. Execute action to change group to single primary mode
#   4. Start a slave connection on server1 to server3.
#      It should fail, since a group action is ongoing.
#   5. Verify occurrence of error message
#   6. Unlock the action
#   7. Clean up
#
###############################################################################

--source include/have_debug_sync.inc
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count= 3
--source include/group_replication.inc

--echo
--echo # 1. server1 start group replication and server2 join

set session sql_log_bin=0;
call mtr.add_suppression("Can't start IO THREAD for channel 'ch3_1' when group replication is running a group configuration operation 'Change to single primary mode'*");
call mtr.add_suppression("Run function 'thread_start' in plugin 'group_replication' failed");
call mtr.add_suppression("Replica I/O for channel 'ch3_1': Fatal error: Failed to run 'thread_start' hook, Error_code:*");
call mtr.add_suppression("Can't start SQL THREAD for channel 'ch3_1' when group replication is running a group configuration operation 'Change to single primary mode'*");
call mtr.add_suppression("Run function 'applier_start' in plugin 'group_replication' failed");
call mtr.add_suppression("Replica SQL for channel 'ch3_1': Fatal error: Failed to run 'applier_start' hook, Error_code:*");
set session sql_log_bin=1;

--source include/start_and_bootstrap_group_replication.inc

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc

--echo
--echo # 2. Activate debug point that will block the group action when changing
--echo #    to single primary mode

SET @@GLOBAL.DEBUG= '+d,group_replication_block_group_action';
--let $server2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)

--echo
--echo # 3. Execute action to change group to single primary mode

--replace_result $server2_uuid MEMBER1_UUID
--send_eval SELECT group_replication_switch_to_single_primary_mode("$server2_uuid")

--echo
--echo # 4. Start a slave connection on server1 to server3. Should fail, action
--echo #    is ongoing

--let $rpl_connection_name= server1
--source include/rpl_connection.inc

--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%Single-primary Switch: checking group pre-conditions%"
--source include/wait_condition.inc

--replace_result $SERVER_MYPORT_3 SERVER_3_PORT
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='localhost', SOURCE_USER='root', SOURCE_PORT=$SERVER_MYPORT_3 for channel 'ch3_1'

--let $rpl_channel_name='ch3_1'

--let $slave_io_errno= convert_error(ER_REPLICA_FATAL_ERROR)
--let $show_slave_io_error= 0
--let $slave_io_error_replace= / at [0-9]*/ at XXX/

--let $slave_sql_errno= convert_error(ER_REPLICA_FATAL_ERROR)
--let $show_slave_sql_error= 0
--let $slave_sql_error_replace= / at [0-9]*/ at XXX/

START SLAVE FOR CHANNEL 'ch3_1';
--source include/wait_for_slave_io_error.inc
--source include/wait_for_slave_sql_error.inc

--let $rpl_channel_name=

--echo
--echo # 5. Verify occurrence of error message

--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_count = 1
--let $assert_select = Can't start IO THREAD for channel 'ch3_1' when group replication is running a group configuration operation
--let $assert_text = Found the expected error about failure to start slave IO THREAD.
--source include/assert_grep.inc

--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_count = 1
--let $assert_select = Can't start SQL THREAD for channel 'ch3_1' when group replication is running a group configuration operation
--let $assert_text = Found the expected error about failure to start slave SQL THREAD.
--source include/assert_grep.inc

--echo
--echo # 6. Unlock the action

--let $rpl_connection_name= server_2
--source include/rpl_connection.inc

SET DEBUG_SYNC= "now SIGNAL signal.action_continue";

--let $rpl_connection_name= server2
--source include/rpl_connection.inc

--replace_result $server2_uuid MEMBER1_UUID
--reap

--echo
--echo # 7. Clean up

--let $rpl_connection_name= server1
--source include/rpl_connection.inc

RESET SLAVE ALL FOR CHANNEL 'ch3_1';

--let $rpl_connection_name= server2
--source include/rpl_connection.inc

SET @@GLOBAL.DEBUG= '-d,group_replication_block_group_action';

--let $rpl_group_replication_single_primary_mode=1
--let $rpl_group_replication_reset_persistent_vars=1
--source include/group_replication_end.inc