File: gr_primary_mode_group_operations_45.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 (96 lines) | stat: -rw-r--r-- 3,583 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
###############################################################################
#
# Any failure to enable the read mode in the server for data protection
# shall result in a server abort.
#
# Test:
#   0. A group of 3 members in multi primary mode.
#   1. Set server 1 to fail when setting the read mode
#   2. Execute a change to single primary mode with server 2 as the primary
#   3. Wait for server 1 to crash and restart it.
#      Check other members see it leave
#   4. Check the error message is in the log
#   5. Cleanup
#
###############################################################################

--source include/have_debug.inc
--source include/not_valgrind.inc
--source include/have_group_replication_plugin.inc
--let $rpl_server_count= 3
--source include/group_replication.inc

--echo
--echo # 1. Set server 1 to fail when setting the read

#This is cleaned on restart
SET @@GLOBAL.DEBUG= '+d,group_replication_read_mode_error';

# Prepare server 1 for impending abort()
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect

--echo
--echo # 2. Execute a change to single primary mode with server 2 as the primary

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

--let $server2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)

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

--echo
--echo # 3. Wait for server 1 to crash and restart it
--echo # Check other members see it leave

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

--source include/wait_until_disconnected.inc

--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc

--let $rpl_server_number= 1
--source include/rpl_reconnect.inc

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

--let $group_replication_number_of_members= 2
--source include/gr_wait_for_number_of_members.inc

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

--replace_result $server2_uuid MEMBER2_UUID
--reap

--echo # 4. Check the error message is in the log

--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_count = 1
--let $assert_select = Cannot enable the super read only mode on a secondary member.
--let $assert_text = Found the expected error in server log
--source include/assert_grep.inc

--echo # 5. Cleanup

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

set session sql_log_bin=0;
call mtr.add_suppression("The plugin encountered a critical error and will abort: Cannot enable the super read only mode on a secondary member.*");
call mtr.add_suppression("Error, maximum number of retries exceeded when waiting for the internal server session state to be operating");
call mtr.add_suppression("Failed to establish an internal server connection to execute plugin operations");
call mtr.add_suppression("There was an issue on the primary election process.*");
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
call mtr.add_suppression("Error while executing a group configuration operation: This operation was locally aborted and for that reason terminated.*");
set session sql_log_bin=1;

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