File: group_replication.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 (75 lines) | stat: -rw-r--r-- 3,554 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
################################################################################
# WL#7660 - GCS PLUGIN IMPLEMENTATION
#
# This test checks the basic functionality of the Group Replication replication
# plugin: the installation, uninstallation of the plugin and the
# update of the plugin status variables.
#
# Test:
# 0. The test requires one server.
# 1. Set group_replication_group_name=<INVALID_VALUE>. Expect error.
# 2. Set group_replication_group_name=<VALID_VALUE>. Assert check the value.
#  - Set group_replication_start_on_boot=1. Assert check the value.
# 3. Restart server to check that plugin is still loaded.
# 4. After the server restart the group name is again set to NULL. Thus, START
#    GROUP_REPLICATION (GR) command must fail.
# 5. Start GR command will succeed when group name is set to valid value.
# 6. Try start GR command again. It must error out since the group is already
#    running. Start GR with valid value. It must start.
# 7. Set group_replication_group_name=<VALID_VALUE>. It must error out i.e. we
#    cannot set group name when group is running.
# 8. Clean up.
################################################################################

--let $group_replication_group_name= 8a94f357-aab4-11df-86ab-c80aa9429563
--source include/have_group_replication_plugin.inc

SET SESSION sql_log_bin= 0;
call mtr.add_suppression("The group_replication_group_name *.*");
SET SESSION sql_log_bin= 1;

--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL group_replication_group_name= "8a94f357-aab4-11df-86ab-invalid";

# This is a valid name being given to the group name

--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
--eval SET GLOBAL group_replication_start_on_boot= 1

--let $assert_text= The value of group name should be $group_replication_group_name
--let $assert_cond= "[SELECT @@group_replication_group_name]" = "$group_replication_group_name"
--source include/assert.inc

--let $assert_text= The value of group_replication_start_on_boot should be 1
--let $assert_cond= [SELECT @@group_replication_start_on_boot] = 1
--source include/assert.inc

# This restart tests that the plugin is still loaded on the server restart
# Also it checks the shutdown hook that is provided as a part of WL#6821.
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
--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
--replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
--source include/restart_mysqld.inc

# After the server restart the group name is again set to NULL which will
# cause an error due to wrong configuration.
--error ER_GROUP_REPLICATION_CONFIGURATION
START GROUP_REPLICATION;

--source include/start_group_replication.inc

# This start command will error out since the group is already running.
--error ER_GROUP_REPLICATION_RUNNING
START GROUP_REPLICATION;


# We cannot set group name when group is running.
# Proper message will be logged on error log.
--error ER_GROUP_REPLICATION_RUNNING
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"

--source include/stop_group_replication.inc
RESET SLAVE ALL FOR CHANNEL "group_replication_applier";

--source include/gr_clear_configuration.inc