Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-9383: Server fails to read master.info after upgrade 10.0 -> 10.1
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.
- Loading branch information
Showing
9 changed files
with
512 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
33 | ||
mysql-bin.000001 | ||
4 | ||
127.0.0.1 | ||
root | ||
|
||
3310 | ||
60 | ||
0 | ||
|
||
|
||
|
||
|
||
|
||
0 | ||
1800.000 | ||
|
||
0 | ||
|
||
0 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
using_gtid=1 | ||
=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
33 | ||
mysql-bin.000001 | ||
4 | ||
127.0.0.1 | ||
root | ||
|
||
3310 | ||
60 | ||
0 | ||
|
||
|
||
|
||
|
||
|
||
0 | ||
1800.000 | ||
|
||
0 | ||
|
||
0 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
using_gtid=1 | ||
|
||
|
||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
33 | ||
mysql-bin.000001 | ||
4 | ||
127.0.0.1 | ||
root | ||
|
||
3310 | ||
60 | ||
0 | ||
|
||
|
||
|
||
|
||
|
||
0 | ||
1800.000 | ||
|
||
0 | ||
|
||
0 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
using_gtid=1 | ||
d=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
33 | ||
mysql-bin.000001 | ||
4 | ||
127.0.0.1 | ||
root | ||
|
||
3310 | ||
60 | ||
0 | ||
|
||
|
||
|
||
|
||
|
||
0 | ||
1800.000 | ||
|
||
0 | ||
|
||
0 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
using_gtid=1 | ||
using_gtid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
33 | ||
mysql-bin.000001 | ||
4 | ||
127.0.0.1 | ||
root | ||
|
||
3310 | ||
60 | ||
0 | ||
|
||
|
||
|
||
|
||
|
||
0 | ||
1800.000 | ||
|
||
0 | ||
|
||
0 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
using_gtid=1 | ||
END_MARKER | ||
do_domain_ids=20 Hulubulu!!?! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
33 | ||
mysql-bin.000001 | ||
4 | ||
127.0.0.1 | ||
root | ||
|
||
3310 | ||
60 | ||
0 | ||
|
||
|
||
|
||
|
||
|
||
0 | ||
1800.000 | ||
|
||
0 | ||
|
||
0 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
using_gtid=1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
include/master-slave.inc | ||
[connection master] | ||
*** MDEV-9383: Server fails to read master.info after upgrade 10.0 -> 10.1 *** | ||
include/stop_slave.inc | ||
CHANGE MASTER TO master_use_gtid=CURRENT_POS; | ||
include/rpl_stop_server.inc [server_number=2] | ||
include/rpl_start_server.inc [server_number=2] | ||
CREATE TABLE t1 (a INT PRIMARY KEY); | ||
INSERT INTO t1 VALUES (1); | ||
include/save_master_gtid.inc | ||
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1; | ||
include/start_slave.inc | ||
include/sync_with_master_gtid.inc | ||
SELECT * FROM t1; | ||
a | ||
1 | ||
include/stop_slave.inc | ||
include/rpl_stop_server.inc [server_number=2] | ||
include/rpl_start_server.inc [server_number=2] | ||
INSERT INTO t1 VALUES (2); | ||
include/save_master_gtid.inc | ||
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1; | ||
include/start_slave.inc | ||
include/sync_with_master_gtid.inc | ||
SELECT * FROM t1 ORDER BY a; | ||
a | ||
1 | ||
2 | ||
include/stop_slave.inc | ||
include/rpl_stop_server.inc [server_number=2] | ||
include/rpl_start_server.inc [server_number=2] | ||
INSERT INTO t1 VALUES (3); | ||
include/save_master_gtid.inc | ||
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1; | ||
include/start_slave.inc | ||
include/sync_with_master_gtid.inc | ||
SELECT * FROM t1 ORDER BY a; | ||
a | ||
1 | ||
2 | ||
3 | ||
include/stop_slave.inc | ||
include/rpl_stop_server.inc [server_number=2] | ||
include/rpl_start_server.inc [server_number=2] | ||
INSERT INTO t1 VALUES (4); | ||
include/save_master_gtid.inc | ||
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1; | ||
include/start_slave.inc | ||
include/sync_with_master_gtid.inc | ||
SELECT * FROM t1 ORDER BY a; | ||
a | ||
1 | ||
2 | ||
3 | ||
4 | ||
include/stop_slave.inc | ||
include/rpl_stop_server.inc [server_number=2] | ||
include/rpl_start_server.inc [server_number=2] | ||
INSERT INTO t1 VALUES (5); | ||
include/save_master_gtid.inc | ||
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1; | ||
include/start_slave.inc | ||
include/sync_with_master_gtid.inc | ||
SELECT * FROM t1 ORDER BY a; | ||
a | ||
1 | ||
2 | ||
3 | ||
4 | ||
5 | ||
include/stop_slave.inc | ||
include/rpl_stop_server.inc [server_number=2] | ||
include/rpl_start_server.inc [server_number=2] | ||
INSERT INTO t1 VALUES (6); | ||
include/save_master_gtid.inc | ||
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1; | ||
include/start_slave.inc | ||
include/sync_with_master_gtid.inc | ||
SELECT * FROM t1 ORDER BY a; | ||
a | ||
1 | ||
2 | ||
3 | ||
4 | ||
5 | ||
6 | ||
DROP TABLE t1; | ||
include/rpl_end.inc |
Oops, something went wrong.