File: gr_autostart_on_install.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 (142 lines) | stat: -rw-r--r-- 4,769 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
################################################################################
# This test validates that no issue exists when a member auto joins an existing
# group during installation.
#
# To test this:
#   0) The test requires two servers: M1 and M2.
#   1) Bootstrap group replication on member 1.
#   2) Restart server 2 with start_on_boot=1 (to enable it for the install)
#      Stop group replication and reset the applier channel.
#   3) Insert some data on server 1 and stop the applier to block recovery on
#      server 2.
#   4) Uninstall and Install the plugin on member 2 (auto start enabled on 2)
#   5) Verify that no transaction can be executed while server 2 recovers.
#   6) Check all is fine after unblocking recovery.
#   7) Clean up.
################################################################################

--source include/big_test.inc
--source include/have_debug_sync.inc
--let $group_replication_group_name= ce94c230-2fc0-11e5-a2cb-0800200c9a66
--source include/have_group_replication_plugin.inc
--source include/force_restart.inc
--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc

--echo #
--echo # Bootstrap group with server 1.
--echo #

--connection server1
--source include/start_and_bootstrap_group_replication.inc

--echo #
--echo # Restart group replication on server 2
--echo # with group_replication_start_on_boot=1
--echo #

--connection server2

--let $allow_rpl_inited= 1
--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_start_on_boot=1
--replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
--source include/restart_mysqld.inc

# Needed as we are not using rpl_restart_server.inc
--let $rpl_server_number= 2
--source include/rpl_reconnect.inc

--let $_init_server2_auto_increment= `SELECT @@GLOBAL.AUTO_INCREMENT_INCREMENT`
--let $_init_server2_auto_offset= `SELECT @@GLOBAL.AUTO_INCREMENT_OFFSET`

--let $group_replication_member_state= ONLINE
--source include/gr_wait_for_member_state.inc

--source include/stop_group_replication.inc

# A RESET MASTER was executed in the context of include/master-slave.inc after
# the server auto started group replication.
# The server applier logs will be reset to avoid recovery problems.
RESET SLAVE ALL FOR CHANNEL "group_replication_applier";

--echo #
--echo # Add some data to server 1.
--echo #

--connection server1

CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);

SET @@GLOBAL.DEBUG='+d,block_applier_updates';

--echo #
--echo # On server 2 uninstall and install the plugin with auto start.
--echo # The plugin should start automatically and recover the missing data
--echo #

--connection server2

--source include/uninstall_group_replication_plugin.inc
--source include/install_group_replication_plugin.inc

--echo #
--echo # On server 2 after restart, recovery should be stuck
--echo # Query execution is not allowed
--echo #

--let $group_replication_member_state= RECOVERING
--source include/gr_wait_for_member_state.inc

--let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.tables WHERE table_name = 't1'
--source include/wait_condition.inc

# install plugin return before set super_read_only, wait to confirm change
--let $wait_condition= SELECT @@GLOBAL.super_read_only = '1'
--source include/wait_condition.inc

--error ER_OPTION_PREVENTS_STATEMENT
INSERT INTO t1 VALUES (2);

--echo #
--echo # After unblocking recovery all should be fine
--echo #

--connection server1

SET DEBUG_SYNC = "now WAIT_FOR applier_read_blocked";
SET @@GLOBAL.DEBUG='-d,block_applier_updates';
SET DEBUG_SYNC = "now SIGNAL resume_applier_read";

--connection server2

--let $group_replication_member_state= ONLINE
--source include/gr_wait_for_member_state.inc

# The data should be there.
--let $wait_condition= SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc

--echo #
--echo # Clean up
--echo #

--connection server1
SET DEBUG_SYNC= 'RESET';

--connection server2
DROP TABLE t1;

--source include/rpl_sync.inc

#Stop group replication and set the auto_increment values recorded on start
--source include/stop_group_replication.inc

# reset auto_increment variables from initial saved values in
# store_group_replication_auto_increment.inc
--let $rpl_server_number=2
--source include/restore_group_replication_auto_increment.inc

--source include/group_replication_end.inc