mirror of
https://github.com/MariaDB/server.git
synced 2025-01-26 08:44:33 +01:00
1cf852d874
In some cases, MariaDB 10.0 could write a master.info file that was read incorrectly by 10.1 and could cause server to fail to start after an upgrade. (If writing a new master.info file that is shorter than the old, extra junk may remain at the end of the file. This is handled properly in 10.1 with an END_MARKER line, but this line is not written by 10.0. The fix here is to make 10.1 robust at reading the master.info files written by 10.0). Fix several things around reading master.info and read_mi_key_from_file(): - read_mi_key_from_file() did not distinguish between a line with and without an eqals '=' sign. - If a line was empty, read_mi_key_from_file() would incorrectly return the key from the previous call. - An extra using_gtid=X line left-over by MariaDB 10.0 might incorrectly be read and overwrite the correct value. - Fix incorrect usage of strncmp() which should be strcmp(). - Add test cases.
163 lines
4.5 KiB
Text
163 lines
4.5 KiB
Text
--source include/master-slave.inc
|
|
|
|
--echo *** MDEV-9383: Server fails to read master.info after upgrade 10.0 -> 10.1 ***
|
|
|
|
--connection slave
|
|
--source include/stop_slave.inc
|
|
CHANGE MASTER TO master_use_gtid=CURRENT_POS;
|
|
--let $datadir= `SELECT @@datadir`
|
|
|
|
--let $rpl_server_number= 2
|
|
--source include/rpl_stop_server.inc
|
|
|
|
--remove_file $datadir/master.info
|
|
--copy_file $MYSQL_TEST_DIR/std_data/bad_master.info $datadir/master.info
|
|
|
|
--let $rpl_server_number= 2
|
|
--source include/rpl_start_server.inc
|
|
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
--connection master
|
|
CREATE TABLE t1 (a INT PRIMARY KEY);
|
|
INSERT INTO t1 VALUES (1);
|
|
--source include/save_master_gtid.inc
|
|
|
|
--connection slave
|
|
# Fix the port after we replaced master.info.
|
|
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
|
|
eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1;
|
|
--source include/start_slave.inc
|
|
--source include/sync_with_master_gtid.inc
|
|
SELECT * FROM t1;
|
|
|
|
--source include/stop_slave.inc
|
|
|
|
--let $rpl_server_number= 2
|
|
--source include/rpl_stop_server.inc
|
|
|
|
--remove_file $datadir/master.info
|
|
--copy_file $MYSQL_TEST_DIR/std_data/bad2_master.info $datadir/master.info
|
|
|
|
--let $rpl_server_number= 2
|
|
--source include/rpl_start_server.inc
|
|
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
--connection master
|
|
INSERT INTO t1 VALUES (2);
|
|
--source include/save_master_gtid.inc
|
|
|
|
--connection slave
|
|
# Fix the port after we replaced master.info.
|
|
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
|
|
eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1;
|
|
--source include/start_slave.inc
|
|
--source include/sync_with_master_gtid.inc
|
|
SELECT * FROM t1 ORDER BY a;
|
|
|
|
--source include/stop_slave.inc
|
|
|
|
--let $rpl_server_number= 2
|
|
--source include/rpl_stop_server.inc
|
|
|
|
--remove_file $datadir/master.info
|
|
--copy_file $MYSQL_TEST_DIR/std_data/bad3_master.info $datadir/master.info
|
|
|
|
--let $rpl_server_number= 2
|
|
--source include/rpl_start_server.inc
|
|
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
--connection master
|
|
INSERT INTO t1 VALUES (3);
|
|
--source include/save_master_gtid.inc
|
|
|
|
--connection slave
|
|
# Fix the port after we replaced master.info.
|
|
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
|
|
eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1;
|
|
--source include/start_slave.inc
|
|
--source include/sync_with_master_gtid.inc
|
|
SELECT * FROM t1 ORDER BY a;
|
|
|
|
--source include/stop_slave.inc
|
|
|
|
--let $rpl_server_number= 2
|
|
--source include/rpl_stop_server.inc
|
|
|
|
--remove_file $datadir/master.info
|
|
--copy_file $MYSQL_TEST_DIR/std_data/bad4_master.info $datadir/master.info
|
|
|
|
--let $rpl_server_number= 2
|
|
--source include/rpl_start_server.inc
|
|
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
--connection master
|
|
INSERT INTO t1 VALUES (4);
|
|
--source include/save_master_gtid.inc
|
|
|
|
--connection slave
|
|
# Fix the port after we replaced master.info.
|
|
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
|
|
eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1;
|
|
--source include/start_slave.inc
|
|
--source include/sync_with_master_gtid.inc
|
|
SELECT * FROM t1 ORDER BY a;
|
|
|
|
--source include/stop_slave.inc
|
|
|
|
--let $rpl_server_number= 2
|
|
--source include/rpl_stop_server.inc
|
|
|
|
--remove_file $datadir/master.info
|
|
--copy_file $MYSQL_TEST_DIR/std_data/bad5_master.info $datadir/master.info
|
|
|
|
--let $rpl_server_number= 2
|
|
--source include/rpl_start_server.inc
|
|
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
--connection master
|
|
INSERT INTO t1 VALUES (5);
|
|
--source include/save_master_gtid.inc
|
|
|
|
--connection slave
|
|
# Fix the port after we replaced master.info.
|
|
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
|
|
eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1;
|
|
--source include/start_slave.inc
|
|
--source include/sync_with_master_gtid.inc
|
|
SELECT * FROM t1 ORDER BY a;
|
|
|
|
--source include/stop_slave.inc
|
|
|
|
--let $rpl_server_number= 2
|
|
--source include/rpl_stop_server.inc
|
|
|
|
--remove_file $datadir/master.info
|
|
--copy_file $MYSQL_TEST_DIR/std_data/bad6_master.info $datadir/master.info
|
|
|
|
--let $rpl_server_number= 2
|
|
--source include/rpl_start_server.inc
|
|
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
--connection master
|
|
INSERT INTO t1 VALUES (6);
|
|
--source include/save_master_gtid.inc
|
|
|
|
--connection slave
|
|
# Fix the port after we replaced master.info.
|
|
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
|
|
eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1;
|
|
--source include/start_slave.inc
|
|
--source include/sync_with_master_gtid.inc
|
|
SELECT * FROM t1 ORDER BY a;
|
|
|
|
|
|
# Cleanup
|
|
--connection master
|
|
DROP TABLE t1;
|
|
--source include/rpl_end.inc
|