| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
|
| 4 |
*** Preparing *** |
| 5 |
connection slave; |
| 6 |
include/stop_slave.inc |
| 7 |
RESET SLAVE; |
| 8 |
SET @restore_slave_net_timeout=@@global.slave_net_timeout; |
| 9 |
connection master; |
| 10 |
RESET MASTER; |
| 11 |
SET @restore_slave_net_timeout=@@global.slave_net_timeout; |
| 12 |
|
| 13 |
connection slave; |
| 14 |
*** Default value *** |
| 15 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root'; |
| 16 |
slave_net_timeout/slave_heartbeat_timeout=2.0000 |
| 17 |
include/reset_slave.inc |
| 18 |
|
| 19 |
*** Reset slave affect *** |
| 20 |
SET @@global.slave_net_timeout=30; |
| 21 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5; |
| 22 |
include/reset_slave.inc |
| 23 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 24 |
Variable_name Value |
| 25 |
Slave_heartbeat_period 15.000 |
| 26 |
|
| 27 |
*** Default value if slave_net_timeout changed *** |
| 28 |
SET @@global.slave_net_timeout=50; |
| 29 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20; |
| 30 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 31 |
Variable_name Value |
| 32 |
Slave_heartbeat_period 25.000 |
| 33 |
SET @@global.slave_net_timeout=@restore_slave_net_timeout; |
| 34 |
include/reset_slave.inc |
| 35 |
|
| 36 |
*** Warning if updated slave_net_timeout < slave_heartbeat_timeout *** |
| 37 |
SET @@global.slave_net_timeout=FLOOR(SLAVE_HEARTBEAT_TIMEOUT)-1; |
| 38 |
SET @@global.slave_net_timeout=@restore_slave_net_timeout; |
| 39 |
RESET SLAVE; |
| 40 |
|
| 41 |
*** Warning if updated slave_heartbeat_timeout > slave_net_timeout *** |
| 42 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=SLAVE_NET_TIMEOUT; |
| 43 |
Warnings: |
| 44 |
Warning 1704 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' seconds. A sensible value for the period should be less than the timeout |
| 45 |
RESET SLAVE; |
| 46 |
|
| 47 |
*** CHANGE MASTER statement only updates slave_heartbeat_period *** |
| 48 |
SET @@global.slave_net_timeout=20; |
| 49 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5; |
| 50 |
SHOW VARIABLES LIKE 'slave_net_timeout'; |
| 51 |
Variable_name Value |
| 52 |
slave_net_timeout 20 |
| 53 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 54 |
Variable_name Value |
| 55 |
Slave_heartbeat_period 5.000 |
| 56 |
SET @@global.slave_net_timeout=2*@@global.slave_net_timeout; |
| 57 |
SHOW VARIABLES LIKE 'slave_net_timeout'; |
| 58 |
Variable_name Value |
| 59 |
slave_net_timeout 40 |
| 60 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 61 |
Variable_name Value |
| 62 |
Slave_heartbeat_period 5.000 |
| 63 |
SET @@global.slave_net_timeout=@restore_slave_net_timeout; |
| 64 |
RESET SLAVE; |
| 65 |
|
| 66 |
*** Update slave_net_timeout on master *** |
| 67 |
connection master; |
| 68 |
SET @@global.slave_net_timeout=500; |
| 69 |
connection slave; |
| 70 |
SET @@global.slave_net_timeout=200; |
| 71 |
RESET SLAVE; |
| 72 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20; |
| 73 |
include/start_slave.inc |
| 74 |
connection master; |
| 75 |
connection slave; |
| 76 |
SHOW VARIABLES LIKE 'slave_net_timeout'; |
| 77 |
Variable_name Value |
| 78 |
slave_net_timeout 200 |
| 79 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 80 |
Variable_name Value |
| 81 |
Slave_heartbeat_period 100.000 |
| 82 |
SET @@global.slave_net_timeout=@restore_slave_net_timeout; |
| 83 |
include/stop_slave.inc |
| 84 |
RESET SLAVE; |
| 85 |
connection master; |
| 86 |
SET @@global.slave_net_timeout=@restore_slave_net_timeout; |
| 87 |
|
| 88 |
*** Start/stop slave *** |
| 89 |
connection slave; |
| 90 |
SET @@global.slave_net_timeout=100; |
| 91 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=20; |
| 92 |
include/start_slave.inc |
| 93 |
connection master; |
| 94 |
connection slave; |
| 95 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 96 |
Variable_name Value |
| 97 |
Slave_heartbeat_period 20.000 |
| 98 |
include/stop_slave.inc |
| 99 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 100 |
Variable_name Value |
| 101 |
Slave_heartbeat_period 20.000 |
| 102 |
|
| 103 |
*** Reload slave *** |
| 104 |
connection slave; |
| 105 |
SET @@global.slave_net_timeout=50; |
| 106 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=30; |
| 107 |
include/rpl_restart_server.inc [server_number=2] |
| 108 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 109 |
Variable_name Value |
| 110 |
Slave_heartbeat_period 30.000 |
| 111 |
SET @restore_slave_net_timeout=@@global.slave_net_timeout; |
| 112 |
|
| 113 |
*** Disable heartbeat *** |
| 114 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0; |
| 115 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 116 |
Variable_name Value |
| 117 |
Slave_heartbeat_period 0.000 |
| 118 |
SHOW STATUS LIKE 'slave_received_heartbeats'; |
| 119 |
Variable_name Value |
| 120 |
Slave_received_heartbeats 0 |
| 121 |
include/start_slave.inc |
| 122 |
connection master; |
| 123 |
connection slave; |
| 124 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 125 |
Variable_name Value |
| 126 |
Slave_heartbeat_period 0.000 |
| 127 |
SHOW STATUS LIKE 'slave_received_heartbeats'; |
| 128 |
Variable_name Value |
| 129 |
Slave_received_heartbeats 0 |
| 130 |
include/stop_slave.inc |
| 131 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 132 |
Variable_name Value |
| 133 |
Slave_heartbeat_period 0.000 |
| 134 |
SHOW STATUS LIKE 'slave_received_heartbeats'; |
| 135 |
Variable_name Value |
| 136 |
Slave_received_heartbeats 0 |
| 137 |
RESET SLAVE; |
| 138 |
SELECT SLAVE_HEARTBEAT_TIMEOUT = 0 AS Result; |
| 139 |
Result |
| 140 |
0 |
| 141 |
|
| 142 |
*** Min slave_heartbeat_timeout *** |
| 143 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.001; |
| 144 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 145 |
Variable_name Value |
| 146 |
Slave_heartbeat_period 0.001 |
| 147 |
RESET SLAVE; |
| 148 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.0009; |
| 149 |
Warnings: |
| 150 |
Warning 1703 The requested value for the heartbeat period is less than 1 millisecond. The value is reset to 0, meaning that heartbeating will effectively be disabled |
| 151 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 152 |
Variable_name Value |
| 153 |
Slave_heartbeat_period 0.000 |
| 154 |
RESET SLAVE; |
| 155 |
|
| 156 |
*** Max slave_heartbeat_timeout *** |
| 157 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=4294967; |
| 158 |
Warnings: |
| 159 |
Warning 1704 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' seconds. A sensible value for the period should be less than the timeout |
| 160 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 161 |
Variable_name Value |
| 162 |
Slave_heartbeat_period 4294967.000 |
| 163 |
RESET SLAVE; |
| 164 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=4294968; |
| 165 |
ERROR HY000: The requested value for the heartbeat period is either negative or exceeds the maximum allowed (4294967 seconds) |
| 166 |
RESET SLAVE; |
| 167 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=8589935; |
| 168 |
ERROR HY000: The requested value for the heartbeat period is either negative or exceeds the maximum allowed (4294967 seconds) |
| 169 |
RESET SLAVE; |
| 170 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=4294967296; |
| 171 |
ERROR HY000: The requested value for the heartbeat period is either negative or exceeds the maximum allowed (4294967 seconds) |
| 172 |
RESET SLAVE; |
| 173 |
|
| 174 |
*** Misc incorrect values *** |
| 175 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD='-1'; |
| 176 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''-1'' at line 1 |
| 177 |
RESET SLAVE; |
| 178 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD='123abc'; |
| 179 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''123abc'' at line 1 |
| 180 |
RESET SLAVE; |
| 181 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=''; |
| 182 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '''' at line 1 |
| 183 |
RESET SLAVE; |
| 184 |
|
| 185 |
*** MDEV-38454: MASTER_HEARTBEAT_PERIOD should accept + sign *** |
| 186 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=+60; |
| 187 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 188 |
Variable_name Value |
| 189 |
Slave_heartbeat_period 60.000 |
| 190 |
RESET SLAVE; |
| 191 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=60; |
| 192 |
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; |
| 193 |
Variable_name Value |
| 194 |
Slave_heartbeat_period 60.000 |
| 195 |
RESET SLAVE; |
| 196 |
|
| 197 |
*** Running slave *** |
| 198 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.1; |
| 199 |
include/start_slave.inc |
| 200 |
connection master; |
| 201 |
connection slave; |
| 202 |
Heartbeat event received |
| 203 |
|
| 204 |
*** Stopped slave *** |
| 205 |
include/stop_slave.inc |
| 206 |
Number of received heartbeat events while slave stopped: 0 |
| 207 |
|
| 208 |
*** Started slave *** |
| 209 |
include/start_slave.inc |
| 210 |
Heartbeat event received |
| 211 |
|
| 212 |
*** Stopped IO thread *** |
| 213 |
include/stop_slave_io.inc |
| 214 |
Number of received heartbeat events while io thread stopped: 0 |
| 215 |
|
| 216 |
*** Started IO thread *** |
| 217 |
START SLAVE IO_THREAD; |
| 218 |
include/wait_for_slave_io_to_start.inc |
| 219 |
Heartbeat event received |
| 220 |
|
| 221 |
*** Stopped SQL thread *** |
| 222 |
include/stop_slave_sql.inc |
| 223 |
Heartbeat events are received while sql thread stopped (1 means 'yes'): 1 |
| 224 |
|
| 225 |
*** Started SQL thread *** |
| 226 |
START SLAVE SQL_THREAD; |
| 227 |
include/wait_for_slave_sql_to_start.inc |
| 228 |
Heartbeat event received |
| 229 |
|
| 230 |
*** Stopped SQL thread by error *** |
| 231 |
connection master; |
| 232 |
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT); |
| 233 |
connection slave; |
| 234 |
INSERT INTO t1 VALUES (1, 'on slave', NULL); |
| 235 |
connection master; |
| 236 |
INSERT INTO t1 VALUES (1, 'on master', NULL); |
| 237 |
connection slave; |
| 238 |
set sql_log_bin= 0; |
| 239 |
call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.. on query.* error.* 1062"); |
| 240 |
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); |
| 241 |
set sql_log_bin= 1; |
| 242 |
Heartbeat events are received while sql thread stopped (1 means 'yes'): 1 |
| 243 |
include/stop_slave_io.inc |
| 244 |
set sql_log_bin= 0; |
| 245 |
DROP TABLE t1; |
| 246 |
set sql_log_bin= 1; |
| 247 |
|
| 248 |
*** Master send to slave *** |
| 249 |
connection master; |
| 250 |
CREATE EVENT e1 |
| 251 |
ON SCHEDULE EVERY 1 SECOND |
| 252 |
DO |
| 253 |
BEGIN |
| 254 |
UPDATE test.t1 SET a = a + 1 WHERE a < 10; |
| 255 |
END| |
| 256 |
Warnings: |
| 257 |
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. |
| 258 |
connection slave; |
| 259 |
include/reset_slave.inc |
| 260 |
Warnings: |
| 261 |
Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-2. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos |
| 262 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5; |
| 263 |
include/start_slave.inc |
| 264 |
connection master; |
| 265 |
SET @@global.event_scheduler=1; |
| 266 |
connection slave; |
| 267 |
connection master; |
| 268 |
connection slave; |
| 269 |
Received heartbeats meet expectations: TRUE |
| 270 |
connection master; |
| 271 |
DELETE FROM t1; |
| 272 |
DROP EVENT e1; |
| 273 |
connection slave; |
| 274 |
|
| 275 |
*** Flush logs on slave *** |
| 276 |
STOP SLAVE; |
| 277 |
include/reset_slave.inc |
| 278 |
set sql_log_bin= 0; |
| 279 |
DROP TABLE t1; |
| 280 |
set sql_log_bin= 1; |
| 281 |
connection master; |
| 282 |
DROP TABLE t1; |
| 283 |
RESET MASTER; |
| 284 |
connection slave; |
| 285 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.5; |
| 286 |
include/start_slave.inc |
| 287 |
Heartbeat events are received while rotation of relay logs (1 means 'yes'): 1 |
| 288 |
|
| 289 |
*** Compressed protocol *** |
| 290 |
connection master; |
| 291 |
SET @@global.slave_compressed_protocol=1; |
| 292 |
connection slave; |
| 293 |
include/stop_slave.inc |
| 294 |
include/reset_slave.inc |
| 295 |
SET @@global.slave_compressed_protocol=1; |
| 296 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.1; |
| 297 |
include/start_slave.inc |
| 298 |
Heartbeat event received |
| 299 |
SET @@global.slave_compressed_protocol=0; |
| 300 |
connection master; |
| 301 |
SET @@global.slave_compressed_protocol=0; |
| 302 |
|
| 303 |
*** Reset master *** |
| 304 |
connection slave; |
| 305 |
STOP SLAVE; |
| 306 |
include/reset_slave.inc |
| 307 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.1; |
| 308 |
include/start_slave.inc |
| 309 |
connection master; |
| 310 |
RESET MASTER; |
| 311 |
connection slave; |
| 312 |
Heartbeat events are received after reset of master (1 means 'yes'): 1 |
| 313 |
|
| 314 |
*** Reload master *** |
| 315 |
connection slave; |
| 316 |
STOP SLAVE; |
| 317 |
include/reset_slave.inc |
| 318 |
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.1; |
| 319 |
include/start_slave.inc |
| 320 |
Heartbeat event received |
| 321 |
include/rpl_restart_server.inc [server_number=1] |
| 322 |
include/wait_for_slave_io_to_start.inc |
| 323 |
Heartbeat event received |
| 324 |
|
| 325 |
*** Circular replication *** |
| 326 |
include/rpl_reset.inc |
| 327 |
include/stop_slave.inc |
| 328 |
include/rpl_change_topology.inc [new topology=1->2->1] |
| 329 |
connection master; |
| 330 |
CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD=1; |
| 331 |
include/start_slave.inc |
| 332 |
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)); |
| 333 |
INSERT INTO t1 VALUES(1, 'on master'); |
| 334 |
connection slave; |
| 335 |
CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD=0.1; |
| 336 |
include/start_slave.inc |
| 337 |
INSERT INTO t1 VALUES(2, 'on slave'); |
| 338 |
connection master; |
| 339 |
SELECT * FROM t1 ORDER BY a; |
| 340 |
a b |
| 341 |
1 on master |
| 342 |
2 on slave |
| 343 |
connection slave; |
| 344 |
SELECT * FROM t1 ORDER BY a; |
| 345 |
a b |
| 346 |
1 on master |
| 347 |
2 on slave |
| 348 |
connection master; |
| 349 |
Heartbeat event received on master |
| 350 |
connection slave; |
| 351 |
Heartbeat event received on slave |
| 352 |
*** Clean up *** |
| 353 |
connection master; |
| 354 |
DROP TABLE t1; |
| 355 |
connection slave; |
| 356 |
SET @@global.slave_net_timeout=@restore_slave_net_timeout; |
| 357 |
include/rpl_end.inc |