Debian Codegraph @

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

raw
1 ###############################################################################
2 #
3 # Functions to execute configuration changes are only present
4 # when the plugin is installed.
5 #
6 # Test:
7 # 0. This test use one server
8 # 1. When plugin is installed the $nr_gr_udfs functions shall be registered
9 # 2. After UNINSTALL the plugin all functions shall be unregistered
10 # The unregistered 3 functions must fail to execute
11 # 3. After INSTALL the plugin shall register $nr_gr_udfs functions
12 # 4. After START GROUP_REPLICATION the plugin shall have $nr_gr_udfs functions
13 # registered
14 # 5. After STOP GROUP_REPLICATION the plugin shall have $nr_gr_udfs functions
15 # registered
16 # 6. Cleanup
17 #
18 ###############################################################################
19
20 --let $nr_gr_udfs= 10
21
22 --source include/have_group_replication_plugin.inc
23 --let $rpl_skip_group_replication_start= 1
24 --source include/group_replication.inc
25
26 --echo
27 --echo # 1. When plugin is installed the $nr_gr_udfs functions shall be registered
28 --let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
29
30 --let $assert_text= "There are $nr_gr_udfs UDF functions registered"
31 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.user_defined_functions WHERE udf_name LIKE "group_replication_%", count, 1] = $nr_gr_udfs
32 --source include/assert.inc
33
34 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
35 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
36
37 --echo
38 --echo # 2. After UNINSTALL the plugin all functions shall be unregistered
39
40 --source include/uninstall_group_replication_plugin.inc
41
42 --let $assert_text= 'There are 0 UDF functions registered'
43 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.user_defined_functions WHERE udf_name LIKE "group_replication_%", count, 1] = 0
44 --source include/assert.inc
45
46 --echo
47 --echo # The unregistered $nr_gr_udfs functions must fail to execute
48 --error ER_SP_DOES_NOT_EXIST
49 SELECT group_replication_switch_to_multi_primary_mode();
50
51 --error ER_SP_DOES_NOT_EXIST
52 SELECT group_replication_switch_to_single_primary_mode();
53
54 --replace_result $server1_uuid MEMBER1_UUID
55 --error ER_SP_DOES_NOT_EXIST
56 --eval SELECT group_replication_switch_to_single_primary_mode("$server1_uuid")
57
58 --replace_result $server1_uuid MEMBER1_UUID
59 --error ER_SP_DOES_NOT_EXIST
60 --eval SELECT group_replication_set_as_primary("$server1_uuid")
61
62 --error ER_SP_DOES_NOT_EXIST
63 SELECT group_replication_get_write_concurrency();
64
65 --error ER_SP_DOES_NOT_EXIST
66 SELECT group_replication_set_write_concurrency(10);
67
68 --error ER_SP_DOES_NOT_EXIST
69 SELECT group_replication_get_group_communication_protocol();
70
71 --error ER_SP_DOES_NOT_EXIST
72 SELECT group_replication_set_group_communication_protocol("5.7.14");
73
74 --echo
75 --echo # 3. After INSTALL the plugin shall register $nr_gr_udfs functions
76
77 --source include/install_group_replication_plugin.inc
78 --source include/clean_group_replication_install_entry.inc
79
80 --let $assert_text= "There are $nr_gr_udfs UDF functions registered"
81 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.user_defined_functions WHERE udf_name LIKE "group_replication_%", count, 1] = $nr_gr_udfs
82 --source include/assert.inc
83
84 --replace_result $_group_replication_group_seeds GROUP_SEEDS
85 --eval SET @@global.group_replication_group_seeds="$_group_replication_group_seeds"
86 --replace_result $_group_replication_local_address LOCAL_ADDRESS
87 --eval SET @@global.group_replication_local_address="$_group_replication_local_address"
88
89 --echo
90 --echo # 4. After START GROUP_REPLICATION the plugin shall have $nr_gr_udfs functions
91 --echo # registered
92
93 --source include/start_and_bootstrap_group_replication.inc
94
95 --let $assert_text= "There are $nr_gr_udfs UDF functions registered"
96 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.user_defined_functions WHERE udf_name LIKE "group_replication_%", count, 1] = $nr_gr_udfs
97 --source include/assert.inc
98
99 --source include/stop_group_replication.inc
100
101 --echo
102 --echo # 5. After STOP GROUP_REPLICATION the plugin shall have $nr_gr_udfs functions
103 --echo # registered
104
105 --let $assert_text= "There are $nr_gr_udfs UDF functions registered"
106 --let $assert_cond= [SELECT COUNT(*) AS count FROM performance_schema.user_defined_functions WHERE udf_name LIKE "group_replication_%", count, 1] = $nr_gr_udfs
107 --source include/assert.inc
108
109 --echo
110 --echo # 6. Cleanup
111
112 --source include/group_replication_end.inc