|
| 1 | +# |
| 2 | +# 1) Create a master-slave setup. |
| 3 | +# |
1 | 4 | include/master-slave.inc
|
2 | 5 | Warnings:
|
3 | 6 | Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
|
4 | 7 | Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
|
5 | 8 | [connection master]
|
6 |
| -call mtr.add_suppression("Got fatal error 1236 from master when reading data from binary log: 'The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires."); |
7 |
| -######## Initialize ######## |
| 9 | +# |
| 10 | +# 2) Create a table on master, sync it, stop the slave threads and dump |
| 11 | +# thread on master. |
| 12 | +# |
8 | 13 | CREATE TABLE t1 (a INT) ENGINE = InnoDB;
|
9 | 14 | include/sync_slave_sql_with_master.inc
|
10 | 15 | include/stop_slave.inc
|
| 16 | +[connection master] |
11 | 17 | include/stop_dump_threads.inc
|
| 18 | +# |
| 19 | +# 3) On master, generate a transaction, flush the binary log and execute |
| 20 | +# PURGE BINARY LOGS TO command so that only remaining binlog only contains |
| 21 | +# transaction UUID:3. |
| 22 | +# |
12 | 23 | INSERT INTO t1 VALUES (1);
|
13 | 24 | FLUSH LOGS;
|
14 | 25 | INSERT INTO t1 VALUES (2);
|
15 | 26 | PURGE BINARY LOGS TO 'master-bin.000002';
|
16 |
| -include/assert.inc [PURGE BINARY LOGS successfully removed all but the latest files] |
17 |
| -INSERT INTO t1 VALUES (2); |
| 27 | +include/assert.inc [PURGE BINARY LOGS successfully removed all but the latest file] |
| 28 | +# |
| 29 | +# 4) Verify that the slave fails if it tries to connect using CHANGE |
| 30 | +# MASTER TO MASTER_AUTO_POSITION=1. |
| 31 | +# |
| 32 | +[connection slave] |
18 | 33 | CHANGE MASTER TO MASTER_AUTO_POSITION = 1;
|
19 | 34 | START SLAVE;
|
20 | 35 | include/wait_for_slave_io_error.inc [errno=1236 # ER_MASTER_FATAL_ERROR_READING_BINLOG]
|
21 | 36 | include/stop_slave_sql.inc
|
22 |
| -CHANGE MASTER TO MASTER_LOG_FILE = 'master-bin.000002', MASTER_LOG_POS = MASTER_POS, MASTER_AUTO_POSITION = 0; |
| 37 | +[connection master] |
| 38 | +SET @saved_debug= @@GLOBAL.DEBUG; |
| 39 | +SET GLOBAL DEBUG= '+d,simulate_long_missing_gtids'; |
| 40 | +[connection slave] |
| 41 | +START SLAVE; |
| 42 | +include/wait_for_slave_io_error.inc [errno=1236 # ER_MASTER_FATAL_ERROR_READING_BINLOG] |
| 43 | +include/stop_slave_sql.inc |
| 44 | +[connection master] |
| 45 | +SET GLOBAL DEBUG= @saved_debug; |
| 46 | +[connection slave] |
| 47 | +# |
| 48 | +# 5) Verify that appropriate messages are logged into master's and slave's |
| 49 | +# error log. |
| 50 | +# |
| 51 | +include/assert_grep.inc [Found the suggestions to extract the missing GTIDs in the master error log.] |
| 52 | +include/assert_grep.inc [Found a message about the long GTIDs in the slave error log.] |
| 53 | +# |
| 54 | +# 6) Verify that replication succeeds if it tries to connect using CHANGE |
| 55 | +# MASTER TO MASTER_LOG_POS. |
| 56 | +# |
| 57 | +CHANGE MASTER TO MASTER_LOG_FILE = 'MASTER_FILE', MASTER_LOG_POS = MASTER_POS, MASTER_AUTO_POSITION = 0; |
23 | 58 | include/start_slave.inc
|
24 | 59 | include/assert.inc [t1 should contain only one row with the value 2]
|
25 |
| -######## Clean up ######## |
26 |
| -=== Stop and reset slave/master (connection slave) ==== |
| 60 | +include/assert_grep.inc [Found warning containing lost GTIDs in the master error log.] |
| 61 | +include/assert_grep.inc [Found warning containing lost GTIDs in the slave error log.] |
| 62 | +[connection master] |
| 63 | +CALL mtr.add_suppression("Cannot replicate to server.*server has purged required binary logs.*"); |
| 64 | +[connection slave] |
| 65 | +CALL mtr.add_suppression("Got fatal error 1236 from master.*Replicate the missing transactions from elsewhere"); |
| 66 | +# |
| 67 | +# 7) Cleanup. |
| 68 | +# |
| 69 | +[connection slave] |
27 | 70 | include/stop_slave.inc
|
28 | 71 | RESET MASTER;
|
29 | 72 | RESET SLAVE;
|
30 |
| -=== Stop and reset master (connection master) ==== |
| 73 | +[connection master] |
31 | 74 | RESET MASTER;
|
32 |
| -=== Start slave (connection slave) ==== |
| 75 | +[connection slave] |
33 | 76 | include/start_slave.inc
|
34 |
| -=== Sync slave with master (connection master/slave) ==== |
| 77 | +[connection master] |
35 | 78 | DROP TABLE t1;
|
36 | 79 | include/sync_slave_sql_with_master.inc
|
37 | 80 | include/rpl_end.inc
|
0 commit comments