From c172f69e15a9dbe262034445b7db4190e7c03849 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Sat, 3 Sep 2016 11:35:23 +0200 Subject: [PATCH 1/2] Don't dump mysql.gtid_executed https://bugs.mysql.com/bug.php?id=82848 Otherwise this will overwrite the value which is set with SET @@GLOBAL.GTID_PURGED=... And this could cause a server to lose the GTID position after a restart --- client/mysqldump.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/mysqldump.c b/client/mysqldump.c index 45506bc..37b81be 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1009,6 +1009,9 @@ static int get_options(int *argc, char ***argv) "mysql.apply_status", MYF(MY_WME))) || my_hash_insert(&ignore_table, (uchar*) my_strdup(PSI_NOT_INSTRUMENTED, + "mysql.gtid_executed", MYF(MY_WME))) || + my_hash_insert(&ignore_table, + (uchar*) my_strdup(PSI_NOT_INSTRUMENTED, "mysql.schema", MYF(MY_WME))) || my_hash_insert(&ignore_table, (uchar*) my_strdup(PSI_NOT_INSTRUMENTED, From 0e12486f635b5b112ab5d9eb586f94ec9d93f180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Sun, 4 Sep 2016 17:44:20 +0200 Subject: [PATCH 2/2] Add test case for Bug #82848 --- mysql-test/r/bug82848.result | 12 ++++++++++++ mysql-test/t/bug82848.test | 22 ++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 mysql-test/r/bug82848.result create mode 100644 mysql-test/t/bug82848.test diff --git a/mysql-test/r/bug82848.result b/mysql-test/r/bug82848.result new file mode 100644 index 0000000..c181da8 --- /dev/null +++ b/mysql-test/r/bug82848.result @@ -0,0 +1,12 @@ +RESET MASTER; +USE test; +CREATE TABLE t1 (id SERIAL); +FLUSH LOGS; +PURGE BINARY LOGS BEFORE NOW(); +Warnings: +Warning 1868 file ./master-bin.000002 was not purged because it is the active log file. +INSERT INTO t1 VALUES(NULL),(NULL),(NULL); +RESET MASTER; +# restart +1 +DROP TABLE t1; diff --git a/mysql-test/t/bug82848.test b/mysql-test/t/bug82848.test new file mode 100644 index 0000000..b545884 --- /dev/null +++ b/mysql-test/t/bug82848.test @@ -0,0 +1,22 @@ +--source include/have_gtid.inc +--source include/force_restart.inc + +RESET MASTER; +USE test; +CREATE TABLE t1 (id SERIAL); +FLUSH LOGS; +PURGE BINARY LOGS BEFORE NOW(); +INSERT INTO t1 VALUES(NULL),(NULL),(NULL); +--exec $MYSQL_DUMP --all-databases --triggers --routines --events --master-data=2 > $MYSQLTEST_VARDIR/tmp/bug82848.sql 2> /dev/null + +RESET MASTER; +--exec $MYSQL --force < $MYSQLTEST_VARDIR/tmp/bug82848.sql +--let $gtid_executed_before= `SELECT @@GLOBAL.GTID_EXECUTED` + +--source include/restart_mysqld.inc +--let $gtid_executed_after= `SELECT @@GLOBAL.GTID_EXECUTED` + +--let $gtid_diff= `SELECT '$gtid_executed_before' = '$gtid_executed_after'` +--echo $gtid_diff + +DROP TABLE t1;