File: gr_replicate_group_to_server.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 (88 lines) | stat: -rw-r--r-- 3,488 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
################################################################################
# This test verifies that the slave server with binlog enabled is able to
# replicate from a member which is part of a Group.
#
# Test:
# 0. The test requires three servers: M1, M2 and M3.
# 1. Bootstrap start a group on M1. Start GR on M2 and add some data.
# 2. Connect the third server to one of the member of the group, establishing
#    an asynchronous replication connection (M1->M3). Start slave on M3.
# 3. On the slave (M3), test that the data is properly replicated after the
#    start slave is completed. Diff check the table on M1 and M3, and, verify
#    binlog events on M3.
# 4. Cleanup.
################################################################################
--source include/big_test.inc
--source include/have_group_replication_plugin.inc
--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count= 3
--source include/group_replication.inc

# Start the first member here
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/start_and_bootstrap_group_replication.inc

# Start the second member. Add some data and sync it in the group.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc
CREATE TABLE test.t1 (i INT PRIMARY KEY);
INSERT INTO test.t1 VALUES(1);
--source include/rpl_sync.inc

# Establish an async connection between the third server and member 1 of
# the group.
--let $rpl_connection_name= server3
--source include/rpl_connection.inc

SET SESSION sql_log_bin= 0;
--source include/gtid_utils.inc
SET SESSION sql_log_bin= 1;

# Make this server the slave of the first server which belongs to the group.
--disable_warnings
--replace_result $MASTER_MYPORT MASTER_PORT
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_PORT=$MASTER_MYPORT, SOURCE_USER='root', SOURCE_AUTO_POSITION=1
--enable_warnings
--source include/start_slave.inc

# Restart GR on M2 and add some data to the group. Verify that the same events are replicated to M3 later.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/stop_group_replication.inc
--source include/start_group_replication.inc
INSERT INTO test.t1 VALUES(2);
--source include/rpl_sync.inc

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $sync_slave_connection= server3
--source include/sync_slave_sql_with_master.inc

--echo # On the slave (server3), test that the data is properly replicated
--echo # after the start slave is complete.
--let $diff_tables= server1:test.t1, server3:test.t1
--source include/diff_tables.inc

# The sequence of events that make up a View Change
--let $vcle_seq= Gtid # Query/BEGIN # View_change # Query/COMMIT
# View change (s1) # View change (s2) # Create table # Insert # View change (s2) # Insert
--let $event_sequence= $vcle_seq # $vcle_seq # !Gtid_transaction # !Gtid_transaction # $vcle_seq # !Gtid_transaction
--source include/assert_binlog_events.inc

# Cleanup
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
DROP TABLE test.t1;

--let $sync_slave_connection= server3
--source include/sync_slave_sql_with_master.inc
--source include/stop_slave.inc
CHANGE REPLICATION SOURCE TO SOURCE_AUTO_POSITION=0;
SET SESSION sql_log_bin= 0;
--source include/gtid_utils_end.inc
SET SESSION sql_log_bin= 1;
--source include/rpl_reset_slave.inc

--source include/group_replication_end.inc