File: rpl_multi_source_repository.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 (148 lines) | stat: -rw-r--r-- 5,799 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
143
144
145
146
147
148
#
# WL#1697: Multisource replication
#
# MSR works only with slave repository type= TABLE.
#
# This tests test the following.
# 1. Start three servers. By default, slave repository is of type FILE
# 2. setup a master-slave replication between server 1 and server 2
#     (a default channel exists between server 1 and server 2)
# 3. Execute CHANGE MASTER to create a new channel.
#    - the command shall fail as we have wrong repository type
# 4. Convert only master info repository to TABLE
#    -  CHANGE MASTER shall fail
# 5. Convert only relay log info repository to TABLE
#   - CHANGE MASTER shall fail
# 6. Convert both master info and relay log info repositories to TABLE
#   -  CHANGE MASTER shall succeed
# 7. Restart the slave server
#   - There shall be errors in server log and slave should not be setup.
#   - subsequent commands shall fail unless the slave is properly restarted.
# 8. Restart the slave server with type=TABLE
#   - success
# 9. Set repositories to FILE
#   - failure with an error message.
# 10. Set repositories to TABLE // doing it again
#    - nothing to do.
#

##Skip on group replication runs
--source include/not_group_replication_plugin.inc
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc

--echo #
--echo # Create a new channel from the slave to the third server.
--echo #  There shall be an error
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc

--replace_result $SERVER_MYPORT_3 MASTER_PORT
--error ER_REPLICA_NEW_CHANNEL_WRONG_REPOSITORY
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST = "127.0.0.1", SOURCE_PORT = $SERVER_MYPORT_3 FOR CHANNEL "channel_3";

--echo #  Convert only master_info_repository to table.
--echo #  The same error shall persist
--source include/stop_slave.inc
SET @@GLOBAL.master_info_repository ="TABLE";

call mtr.add_suppression("Replica: Cannot create new connection metadata structure when repositories are of type FILE. Convert replica repositories to TABLE to replicate from multiple sources.");

--replace_result $SERVER_MYPORT_3 MASTER_PORT
--error ER_REPLICA_NEW_CHANNEL_WRONG_REPOSITORY
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST = "127.0.0.1", SOURCE_USER = "root", SOURCE_PORT = $SERVER_MYPORT_3 FOR CHANNEL "channel_3";

--echo #  Convert only relay log info repository to TABLE
--echo #  The same error shall remain
SET @@GLOBAL.master_info_repository = "FILE";
SET @@GLOBAL.relay_log_info_repository = "TABLE";


--replace_result $SERVER_MYPORT_3 MASTER_PORT
--error ER_REPLICA_NEW_CHANNEL_WRONG_REPOSITORY
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST = "127.0.0.1", SOURCE_USER = "root", SOURCE_PORT = $SERVER_MYPORT_3 FOR CHANNEL "channel_3";

--echo #
--echo # Convert both repositories to TABLE. CHANGE MASTER command passes
--echo #
#As relay_log_info_repository is already set to TABLE, set master_info_repository to TABLE
SET @@GLOBAL.master_info_repository = "TABLE";

--replace_result $SERVER_MYPORT_3 MASTER_PORT
--replace_column 2 #
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST ="127.0.0.1", SOURCE_USER ="root", SOURCE_PORT=$SERVER_MYPORT_3 FOR CHANNEL "channel_3"

--echo # Slave now is a multisourced slave.
--echo # Restart the slave and check that slave threads are not started because
--echo # the repositories are of type FILE
call mtr.add_suppression("Replica: This replica was a multisourced replica previously*");
call mtr.add_suppression("Failed to create or recover replication info repositories");

--let $rpl_server_number=2
--source include/rpl_restart_server.inc
# SHOW SLAVE STATUS will be empty
--query_vertical SHOW SLAVE STATUS
# Assert that pfs tables are empty
--let $assert_text= there shall be only 0 rows as the slave is not configured.
--let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_applier_configuration] =0;
--source include/assert.inc

# subsequent commands shall fail with ER_REPLICA_CONFIGURATION i.e slave not setup
# but due to bug19344559 is setup. The error currently fails with
#  ER_REPLICA_NEW_CHANNEL_WRONG_REPOSITORY
# --error ER_REPLICA_CONFIGURATION
# --eval CHANGE MASTER TO MASTER_HOST = "127.0.0.1", MASTER_PORT = $SERVER_MYPORT_3 FOR CHANNEL "channel_3"

--echo #
--echo #   Test that if slave server is started with TABLE, replication proceeds
--echo #   as usual.
--let $rpl_server_number=2
--let $rpl_server_parameters=--master-info-repository=TABLE --relay-log-info-repository=TABLE
--source include/rpl_restart_server.inc
#assert that two rows are present
--let $assert_text= there shall be only 2 rows as slave is restarted properly
--let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_applier_configuration] = 2;
--source include/assert.inc

--echo #
--echo #   Set slave repostiories to FILE. An error is generated.
--echo #

--error ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE
SET @@GLOBAL.master_info_repository = "FILE";

--error ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE
SET @@GLOBAL.relay_log_info_repository = "FILE";

SHOW VARIABLES LIKE '%info_repository%';

--echo #
--echo #  Currently slave repositores are of type TABLE. Try again
--echo #  again setting to TABLE. Returns success doing nothing.
--echo #

SET @@GLOBAL.master_info_repository = "TABLE";
SET @@GLOBAL.relay_log_info_repository = "TABLE";

# Clean up.
# Delete channel_3 and restart server with FILE
#
# Stop slave for channel_3
--let $rpl_channel_name= 'channel_3'
--source include/stop_slave.inc

# Reset slave for channel_3
RESET SLAVE ALL FOR CHANNEL 'channel_3';

--let $rpl_channel_name=

--let $rpl_server_number= 2
--let $rpl_server_parameters=--master-info-repository=FILE --relay-log-info-repository=FILE
--source include/rpl_restart_server.inc

#End MSR setup
--let $rpl_only_running_threads= 1
--let $rpl_group_replication= 1
--source include/rpl_end.inc