Debian Codegraph @

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

raw
1 ################################################################################
2 # WL#7660 - GCS PLUGIN IMPLEMENTATION
3 #
4 # This test checks the basic functionality of the Group Replication replication
5 # plugin: the installation, uninstallation of the plugin and the
6 # update of the plugin status variables.
7 #
8 # Test:
9 # 0. The test requires one server.
10 # 1. Set group_replication_group_name=<INVALID_VALUE>. Expect error.
11 # 2. Set group_replication_group_name=<VALID_VALUE>. Assert check the value.
12 # - Set group_replication_start_on_boot=1. Assert check the value.
13 # 3. Restart server to check that plugin is still loaded.
14 # 4. After the server restart the group name is again set to NULL. Thus, START
15 # GROUP_REPLICATION (GR) command must fail.
16 # 5. Start GR command will succeed when group name is set to valid value.
17 # 6. Try start GR command again. It must error out since the group is already
18 # running. Start GR with valid value. It must start.
19 # 7. Set group_replication_group_name=<VALID_VALUE>. It must error out i.e. we
20 # cannot set group name when group is running.
21 # 8. Clean up.
22 ################################################################################
23
24 --let $group_replication_group_name= 8a94f357-aab4-11df-86ab-c80aa9429563
25 --source include/have_group_replication_plugin.inc
26
27 SET SESSION sql_log_bin= 0;
28 call mtr.add_suppression("The group_replication_group_name *.*");
29 SET SESSION sql_log_bin= 1;
30
31 --error ER_WRONG_VALUE_FOR_VAR
32 SET GLOBAL group_replication_group_name= "8a94f357-aab4-11df-86ab-invalid";
33
34 # This is a valid name being given to the group name
35
36 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
37 --eval SET GLOBAL group_replication_start_on_boot= 1
38
39 --let $assert_text= The value of group name should be $group_replication_group_name
40 --let $assert_cond= "[SELECT @@group_replication_group_name]" = "$group_replication_group_name"
41 --source include/assert.inc
42
43 --let $assert_text= The value of group_replication_start_on_boot should be 1
44 --let $assert_cond= [SELECT @@group_replication_start_on_boot] = 1
45 --source include/assert.inc
46
47 # This restart tests that the plugin is still loaded on the server restart
48 # Also it checks the shutdown hook that is provided as a part of WL#6821.
49 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
50 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
51 --let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_bootstrap_group=1
52 --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
53 --source include/restart_mysqld.inc
54
55 # After the server restart the group name is again set to NULL which will
56 # cause an error due to wrong configuration.
57 --error ER_GROUP_REPLICATION_CONFIGURATION
58 START GROUP_REPLICATION;
59
60 --source include/start_group_replication.inc
61
62 # This start command will error out since the group is already running.
63 --error ER_GROUP_REPLICATION_RUNNING
64 START GROUP_REPLICATION;
65
66
67 # We cannot set group name when group is running.
68 # Proper message will be logged on error log.
69 --error ER_GROUP_REPLICATION_RUNNING
70 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
71
72 --source include/stop_group_replication.inc
73 RESET SLAVE ALL FOR CHANNEL "group_replication_applier";
74
75 --source include/gr_clear_configuration.inc