Debian Codegraph @

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

raw
1 ###############################################################################
2 # Validate that when a group is being bootstrapped on server start, all
3 # configured replication channels MUST be started unless skipped
4 # (through --skip-slave-start).
5 #
6 # Test:
7 # 0. This test requires 2 servers
8 # server1: single server
9 # server2: group in single-primary mode
10 # server2 will replicate from server1.
11 # 1. Configure a replication channel to replicate from server1
12 # 2. Restart the server with GR configured to start together with
13 # server, and set --skip_slave_start=0.
14 # 3. Wait until server is up.
15 # Check that GR and replication channel are working.
16 # 4. Write something on server1 and read it on server2.
17 # 5. Clean up
18 ###############################################################################
19 --source include/big_test.inc
20 --source include/force_restart.inc
21 --source include/have_group_replication_plugin.inc
22 --let $rpl_group_replication_single_primary_mode=1
23 --let $rpl_skip_group_replication_start= 1
24 --source include/group_replication.inc
25
26
27 --echo
28 --echo ############################################################
29 --echo # 1. Configure a replication channel to replicate from server1
30 --let $rpl_connection_name= server2
31 --source include/rpl_connection.inc
32
33 --replace_result $SERVER_MYPORT_1 SERVER_1_PORT
34 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_AUTO_POSITION=1, SOURCE_PORT=$SERVER_MYPORT_1
35
36
37 --echo
38 --echo ############################################################
39 --echo # 2. Restart the server with GR configured to start together with
40 --echo # server, and set --skip_slave_start=0.
41 --let $rpl_connection_name= server2
42 --source include/rpl_connection.inc
43 --let $allow_rpl_inited= 1
44 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
45 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
46 --let $restart_parameters=restart:--group_replication_group_name=$group_replication_group_name --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_bootstrap_group=1 --group_replication_start_on_boot=1 --group_replication_single_primary_mode=1 --group_replication_enforce_update_everywhere_checks=0 --skip_slave_start=0
47 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
48 --source include/restart_mysqld.inc
49
50
51 --echo
52 --echo ############################################################
53 --echo # 3. Wait until server is up.
54 --echo # Check that GR and replication channel are working.
55 --let $rpl_server_number= 2
56 --source include/rpl_reconnect.inc
57
58 --let $rpl_connection_name= server2
59 --source include/rpl_connection.inc
60
61 --let $group_replication_member_state= ONLINE
62 --source include/gr_wait_for_member_state.inc
63
64 --source include/gr_assert_primary_member.inc
65
66 --source include/wait_for_slave_to_start.inc
67
68
69 --echo
70 --echo ############################################################
71 --echo # 4. Write something on server1 and read it on server2.
72 --let $rpl_connection_name= server1
73 --source include/rpl_connection.inc
74 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
75 INSERT INTO t1 VALUES (1);
76
77 --let $sync_slave_connection= server2
78 --source include/sync_slave_sql_with_master.inc
79
80 --let $rpl_connection_name= server2
81 --source include/rpl_connection.inc
82 --let $assert_text= 'There is one row in t1'
83 --let $assert_cond= [SELECT COUNT(*) count FROM t1, count, 1] = 1
84 --source include/assert.inc
85
86
87 --echo
88 --echo ############################################################
89 --echo # 5. Clean up.
90 --let $rpl_connection_name= server1
91 --source include/rpl_connection.inc
92 DROP TABLE t1;
93
94 --let $sync_slave_connection= server2
95 --source include/sync_slave_sql_with_master.inc
96
97 --source include/group_replication_end.inc