Debian Codegraph @

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

raw
1 ################################################################################
2 # Validate that even when server is started with server_id=0, on
3 # which situation slave infrastructure is not initialized, and even
4 # when server_id is changed dynamically, which does not initialize
5 # slave infrastructure, START GROUP REPLICATION command errors out
6 # properly.
7 #
8 # Test:
9 # 0. The test requires one server.
10 # 1. Restart server with server_id=0, slave infrastructure will not be
11 # initialized.
12 # 2. Start GR on server should fail. INSTALL PLUGIN should fail.
13 # 3. Even after set server_id to different from 0, start GR must fail.
14 # INSTALL PLUGIN should succeed.
15 # 4. Cleanup.
16 ################################################################################
17 --source include/force_restart.inc
18 --source include/have_group_replication_plugin.inc
19 --let $rpl_skip_group_replication_start= 1
20 --source include/group_replication.inc
21
22 # Store runtime configuration
23 --let $_server_id= `SELECT @@GLOBAL.server_id`
24 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
25 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
26
27 # Error log suppressions
28 SET SESSION sql_log_bin= 0;
29 call mtr.add_suppression("For the creation of replication channels the server id must be different from 0");
30 call mtr.add_suppression("Failure during Group Replication handler initialization");
31 call mtr.add_suppression("Plugin 'group_replication' init function returned error.");
32 call mtr.add_suppression("Couldn't load plugin named 'group_replication' with soname 'group_replication.*'");
33 call mtr.add_suppression("Failure when cleaning Group Replication server state");
34 call mtr.add_suppression("Failure when unregistering the server state observers");
35 call mtr.add_suppression("Failure when unregistering the transactions state observers");
36 call mtr.add_suppression("Failure when unregistering the binlog state observers");
37 call mtr.add_suppression("Group Replication plugin is not installed");
38 call mtr.add_suppression("For the creation of replication channels the server id must be different from 0");
39 call mtr.add_suppression("Unable to start Group Replication. Replication applier infrastructure is not initialized since the server was started with server_id=0. Please, restart the server with server_id larger than 0.");
40 call mtr.add_suppression("Function 'group_replication' already exists");
41 call mtr.add_suppression("Could not uninstall Group Replication UDF functions. Try to remove them manually if present.");
42 SET SESSION sql_log_bin= 1;
43
44
45 --echo
46 --echo ############################################################
47 --echo # 1. Restart server with server_id=0, slave infrastructure
48 --echo # will not be initialized.
49 --let $allow_rpl_inited= 1
50 --let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_group_name=$group_replication_group_name --server_id=0
51 --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
52 --source include/restart_mysqld.inc
53 # Needed as we are not using rpl_restart_server.inc
54 --let $rpl_server_number= 1
55 --source include/rpl_reconnect.inc
56
57
58 --echo
59 --echo ############################################################
60 --echo # 2. Both start and install plugin must fail.
61 --error ER_GROUP_REPLICATION_CONFIGURATION
62 START GROUP_REPLICATION;
63
64 --replace_result $GROUP_REPLICATION GROUP_REPLICATION
65 --error ER_CANT_INITIALIZE_UDF
66 --eval INSTALL PLUGIN group_replication SONAME '$GROUP_REPLICATION'
67
68
69 --echo
70 --echo ############################################################
71 --echo # 3. Even after set server_id to different from 0, start
72 --echo # must fail.
73 --echo # Install plugin will succeed.
74 --eval SET GLOBAL server_id= $_server_id
75 --source include/install_group_replication_plugin.inc
76
77 --error ER_GROUP_REPLICATION_CONFIGURATION
78 START GROUP_REPLICATION;
79
80 --error ER_GROUP_REPLICATION_CONFIGURATION
81 START GROUP_REPLICATION;
82
83
84 --echo
85 --echo ############################################################
86 --echo # 4. Cleanup.
87 --echo # Restart server with server_id different from 0, so that
88 --echo # slave infrastructure will be initialized, and RESET
89 --echo # SLAVE operations on group_replication_end.inc do work.
90 --let $allow_rpl_inited= 1
91 --let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_group_name=$group_replication_group_name --server_id=$_server_id
92 --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
93 --source include/restart_mysqld.inc
94 # Needed as we are not using rpl_restart_server.inc
95 --let $rpl_server_number= 1
96 --source include/rpl_reconnect.inc
97
98 --source include/group_replication_end.inc