Debian Codegraph @

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

raw
1 ################################################################################
2 # The intent of this test is to verify if the validations that were created
3 # within the group replication plugin in the startup process are fully
4 # functional.
5 #
6 # It will test the static variables:
7 # - Table repositories. It will be set to FILE in order to fail.
8 #
9 # Test:
10 # 0. The test requires one server.
11 # - Install plugin at startup.
12 # 1. Test with relay_log_info_repository=FILE and master_info_repository=TABLE.
13 # START GROUP_REPLICATION must fail.
14 # 2. Test with relay_log_info_repository=TABLE and master_info_repository=FILE.
15 # START GROUP_REPLICATION must fail.
16 # 3. Test with relay_log_info_repository=FILE and master_info_repository=FILE.
17 # START GROUP_REPLICATION must fail.
18 # 4. Test with relay_log_info_repository=TABLE and master_info_repository=TABLE.
19 # START GROUP_REPLICATION must succeed.
20 # 5. Test that variables cannot be changed when group replication is running.
21 # - Set master_info_repository=FILE. It must fail.
22 # - Set relay_log_info_repository=FILE. It must fail.
23 # 6. Clean up.
24 ################################################################################
25
26 --let $skip_recovery_configuration=1
27 --source include/have_binlog_format_row.inc
28
29 --let $group_replication_group_name= 56ada920-9d9f-11e4-bd06-0800200c9a66
30
31 # The section below is present in "have_group_replication_plugin.inc."
32 # But since this test is evaluating the absence of certain configurations, one
33 # is not able to use that file since it enforces the existence of such
34 # parameters in the server.
35
36 if (`SELECT @@have_dynamic_loading != 'YES'`) {
37 --skip Requires dynamic loading
38 }
39
40 if (!`select count(*) from information_schema.plugins where PLUGIN_NAME like 'group_replication'`)
41 {
42 --skip Needs Group Replication plugin
43 }
44
45 --source include/rpl_group_replication_default_connections.inc
46 --source include/gr_configuration.inc
47 --source include/gr_set_bootstrap_group.inc
48
49 SET @saved_rli_rep= @@GLOBAL.relay_log_info_repository;
50 SET @saved_mi_rep= @@GLOBAL.master_info_repository;
51
52 # If a channel exists from a previous run it must be removed for the test to run
53
54 --let $group_rep_exist= `SELECT COUNT(*) FROM mysql.slave_relay_log_info WHERE channel_name='group_replication_applier'`
55 if ($group_rep_exist) {
56 --disable_result_log
57 --disable_query_log
58 RESET SLAVE ALL FOR CHANNEL "group_replication_applier";
59 --enable_query_log
60 --enable_result_log
61
62 }
63
64 #
65 # Test with the relay log repository set to FILE
66 #
67
68 SET @@GLOBAL.relay_log_info_repository='FILE';
69 SET @@GLOBAL.master_info_repository='TABLE';
70
71 --let $rli_rep = `SELECT @@GLOBAL.relay_log_info_repository`
72 --let $assert_text= Relay log repository info storage is set to file
73 --let $assert_cond= "$rli_rep" = "FILE"
74 --source include/assert.inc
75
76 --let $mi_rep = `SELECT @@GLOBAL.master_info_repository`
77 --let $assert_text= Master info repository info storage is set to file
78 --let $assert_cond= "$mi_rep" = "TABLE"
79 --source include/assert.inc
80
81 --error ER_GROUP_REPLICATION_CONFIGURATION
82 START GROUP_REPLICATION;
83
84 #
85 # Test with the master info repository set to FILE
86 #
87
88 SET @@GLOBAL.relay_log_info_repository='TABLE';
89 SET @@GLOBAL.master_info_repository='FILE';
90
91 --let $rli_rep = `SELECT @@GLOBAL.relay_log_info_repository`
92 --let $assert_text= Relay log repository info storage is set to file
93 --let $assert_cond= "$rli_rep" = "TABLE"
94 --source include/assert.inc
95
96 --let $mi_rep = `SELECT @@GLOBAL.master_info_repository`
97 --let $assert_text= Master info repository info storage is set to file
98 --let $assert_cond= "$mi_rep" = "FILE"
99 --source include/assert.inc
100
101 --error ER_GROUP_REPLICATION_CONFIGURATION
102 START GROUP_REPLICATION;
103
104 #
105 # Test with both repositories set to FILE
106 #
107
108 SET @@GLOBAL.relay_log_info_repository='FILE';
109 SET @@GLOBAL.master_info_repository='FILE';
110
111 --let $rli_rep = `SELECT @@GLOBAL.relay_log_info_repository`
112 --let $assert_text= Relay log repository info storage is set to file
113 --let $assert_cond= "$rli_rep" = "FILE"
114 --source include/assert.inc
115
116 --let $mi_rep = `SELECT @@GLOBAL.master_info_repository`
117 --let $assert_text= Master info repository info storage is set to file
118 --let $assert_cond= "$mi_rep" = "FILE"
119 --source include/assert.inc
120
121 --error ER_GROUP_REPLICATION_CONFIGURATION
122 START GROUP_REPLICATION;
123
124 #
125 # Test that the variable cannot be changed when group replication is running
126 #
127
128 SET sql_log_bin=0;
129 CREATE USER 'internal_usr'@'%' IDENTIFIED BY 'unique_password';
130 GRANT GROUP_REPLICATION_STREAM ON *.* TO 'internal_usr'@'%';
131 FLUSH PRIVILEGES;
132 SET sql_log_bin=1;
133
134 SET @@GLOBAL.relay_log_info_repository='TABLE';
135 SET @@GLOBAL.master_info_repository='TABLE';
136
137 --disable_warnings
138 CHANGE MASTER TO MASTER_USER='internal_usr', MASTER_PASSWORD='unique_password' FOR CHANNEL 'group_replication_recovery';
139 --enable_warnings
140
141 --source include/start_group_replication.inc
142
143 --error ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE
144 SET @@GLOBAL.master_info_repository='FILE';
145
146 --error ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE
147 SET @@GLOBAL.relay_log_info_repository='FILE';
148
149 #
150 # Cleanup
151 #
152
153 --source include/stop_group_replication.inc
154
155 #--echo @saved_rli_rep
156 #--echo @saved_mi_rep
157
158 SET @@GLOBAL.relay_log_info_repository= @saved_rli_rep;
159 SET @@GLOBAL.master_info_repository= @saved_mi_rep;
160
161 call mtr.add_suppression("Connection metadata repository must be set to TABLE.");
162 call mtr.add_suppression("Applier metadata repository must be set to TABLE.");
163
164 SET sql_log_bin=0;
165 DROP USER 'internal_usr';
166 SET sql_log_bin=1;
167
168 --source include/gr_clear_configuration.inc