From 1cf852d874b0e82ebfa3854300abaacd04d3eb01 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Thu, 7 Apr 2016 14:44:29 +0200 Subject: 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. --- mysql-test/std_data/bad2_master.info | 35 ++++++++++++++++++++++++++++++++++ mysql-test/std_data/bad3_master.info | 37 ++++++++++++++++++++++++++++++++++++ mysql-test/std_data/bad4_master.info | 35 ++++++++++++++++++++++++++++++++++ mysql-test/std_data/bad5_master.info | 35 ++++++++++++++++++++++++++++++++++ mysql-test/std_data/bad6_master.info | 36 +++++++++++++++++++++++++++++++++++ mysql-test/std_data/bad_master.info | 35 ++++++++++++++++++++++++++++++++++ 6 files changed, 213 insertions(+) create mode 100644 mysql-test/std_data/bad2_master.info create mode 100644 mysql-test/std_data/bad3_master.info create mode 100644 mysql-test/std_data/bad4_master.info create mode 100644 mysql-test/std_data/bad5_master.info create mode 100644 mysql-test/std_data/bad6_master.info create mode 100644 mysql-test/std_data/bad_master.info (limited to 'mysql-test/std_data') diff --git a/mysql-test/std_data/bad2_master.info b/mysql-test/std_data/bad2_master.info new file mode 100644 index 00000000000..61722562748 --- /dev/null +++ b/mysql-test/std_data/bad2_master.info @@ -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 diff --git a/mysql-test/std_data/bad3_master.info b/mysql-test/std_data/bad3_master.info new file mode 100644 index 00000000000..6e632cd9a49 --- /dev/null +++ b/mysql-test/std_data/bad3_master.info @@ -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 diff --git a/mysql-test/std_data/bad4_master.info b/mysql-test/std_data/bad4_master.info new file mode 100644 index 00000000000..87572efc8a4 --- /dev/null +++ b/mysql-test/std_data/bad4_master.info @@ -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 diff --git a/mysql-test/std_data/bad5_master.info b/mysql-test/std_data/bad5_master.info new file mode 100644 index 00000000000..4ea8113250b --- /dev/null +++ b/mysql-test/std_data/bad5_master.info @@ -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 diff --git a/mysql-test/std_data/bad6_master.info b/mysql-test/std_data/bad6_master.info new file mode 100644 index 00000000000..0f48f4871f0 --- /dev/null +++ b/mysql-test/std_data/bad6_master.info @@ -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!!?! diff --git a/mysql-test/std_data/bad_master.info b/mysql-test/std_data/bad_master.info new file mode 100644 index 00000000000..1541fdf2c61 --- /dev/null +++ b/mysql-test/std_data/bad_master.info @@ -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 + -- cgit v1.2.1