Debian Codegraph @

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

raw
1 ################################################################################
2 # This test verifies that server reports warnings upon start for persisted group
3 # replication variables, if plugin is not loaded. Later post installation,
4 # variable_source is shown as PERSISTED.
5 #
6 # Test:
7 # 0. The test requires one server.
8 # 1. Persist configuration on server1. Uninstall group replication plugin.
9 # 2. Restart server1 without plugin-load, it must NOT bootstrap the group.
10 # Verify proper warnings are generated.
11 # 3. Install plugin and verify that variable_source is shown as PERSISTED and
12 # group is bootstrapped.
13 # 4. Restart server1 with plugin-load. Verify group is bootstrapped.
14 # 5. Clean up.
15 ################################################################################
16 --source include/big_test.inc
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 --echo
23 --echo ############################################################
24 --echo # 1. Persist configuration on server1. Uninstall plugin.
25 --let $rpl_connection_name= server1
26 --source include/rpl_connection.inc
27
28 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
29 --eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
30 --eval SET PERSIST group_replication_group_seeds= @@GLOBAL.group_replication_group_seeds
31 --eval SET PERSIST group_replication_local_address= @@GLOBAL.group_replication_local_address
32 SET PERSIST group_replication_start_on_boot= ON;
33 SET PERSIST group_replication_bootstrap_group= ON;
34
35 --let $assert_text= 'Expect 6 persisted variables.'
36 --let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = 6
37 --source include/assert.inc
38
39 --source include/uninstall_group_replication_plugin.inc
40
41
42 --echo
43 --echo ############################################################
44 --echo # 2. Restart server1 without plugin-load, it must NOT
45 --echo # bootstrap the group. Verify warnings are generated.
46 SET SESSION sql_log_bin= 0;
47 call mtr.add_suppression("unknown variable 'loose_group_replication");
48 SET SESSION sql_log_bin= 1;
49
50 --let $allow_rpl_inited= 1
51 --let $restart_parameters="restart: --plugin-load="
52 --source include/restart_mysqld.inc
53 --let $rpl_server_number= 1
54 --source include/rpl_reconnect.inc
55
56 --echo
57 --let $assert_text= 'There must be NO variable shown as persisted in variables_info table.'
58 --let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.variables_info WHERE variable_source="PERSISTED", count, 1] = 0
59 --source include/assert.inc
60
61 --echo
62 --let $grep_file= $MYSQLTEST_VARDIR/tmp/gr_persisted_variables_without_plugin.err
63 --let $grep_pattern= unknown variable 'loose_group_replication_
64 --let $grep_output= print_count
65 --source include/grep_pattern.inc
66
67 --echo
68 --echo ############################################################
69 --echo # 3. Install plugin and verify that variable_source is shown
70 --echo # as PERSISTED and group is bootstrapped.
71 --source include/install_group_replication_plugin.inc
72
73 --let $group_replication_member_state= ONLINE
74 --source include/gr_wait_for_member_state.inc
75
76 --let $assert_text= 'Expect 6 persisted variables shown as PERSISTED in variables_info table.'
77 --let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.variables_info WHERE variable_source="PERSISTED", count, 1] = 6
78 --source include/assert.inc
79
80 --let $assert_text= 'Expect 6 persisted variables with matching persisted and global values.'
81 --let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.variables_info vi JOIN performance_schema.persisted_variables pv JOIN performance_schema.global_variables gv ON vi.variable_name=pv.variable_name AND vi.variable_name=gv.variable_name AND pv.variable_value=gv.variable_value WHERE vi.variable_source="PERSISTED", count, 1] = 6
82 --source include/assert.inc
83
84 --source include/uninstall_group_replication_plugin.inc
85
86 --echo
87 --echo ############################################################
88 --echo # 4. Restart server again with plugin-load. Verify group is
89 --echo # bootstrapped.
90 --let $allow_rpl_inited= 1
91 --let $restart_parameters=
92 --source include/restart_mysqld.inc
93 --let $rpl_server_number= 1
94 --source include/rpl_reconnect.inc
95 --let $MYSQLD_DATADIR= `select @@datadir;`
96
97 --let $group_replication_member_state= ONLINE
98 --source include/gr_wait_for_member_state.inc
99
100 --let $assert_text= 'Expect 6 persisted variables shown as PERSISTED in variables_info table.'
101 --let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.variables_info WHERE variable_source="PERSISTED", count, 1] = 6
102 --source include/assert.inc
103
104 --let $assert_text= 'Expect 6 persisted variables with matching persisted and global values.'
105 --let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.variables_info vi JOIN performance_schema.persisted_variables pv JOIN performance_schema.global_variables gv ON vi.variable_name=pv.variable_name AND vi.variable_name=gv.variable_name AND pv.variable_value=gv.variable_value WHERE vi.variable_source="PERSISTED", count, 1] = 6
106 --source include/assert.inc
107
108
109 --echo
110 --echo ############################################################
111 --echo # 5. Clean up.
112 --let $rpl_connection_name= server1
113 --source include/rpl_connection.inc
114 RESET PERSIST;
115 --remove_file $MYSQLD_DATADIR/mysqld-auto.cnf
116 SET GLOBAL group_replication_start_on_boot= OFF;
117 SET GLOBAL group_replication_bootstrap_group= OFF;
118
119 --let $assert_text= 'There must be 0 persisted variables.'
120 --let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = 0
121 --source include/assert.inc
122
123 --source include/group_replication_end.inc