From a6f9694650743f7ae33e505429595c1860da70d2 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 11 Oct 2022 11:02:27 +0200 Subject: [PATCH] MDEV-29736 mysqldump sets system_versioning_insert_history=1 twice and doesn't restore previous value --- client/mysqldump.c | 4 ++-- mysql-test/suite/versioning/r/data.result | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index dcc8c6ed69bae..de6c4ac35bedb 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -4329,7 +4329,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, if (versioned && !opt_xml && opt_dump_history) { - fprintf(md_result_file,"/*!101100 SET system_versioning_insert_history=1 */;\n"); + fprintf(md_result_file,"/*!101100 SET @old_system_versioning_insert_history=@@session.system_versioning_insert_history, @@session.system_versioning_insert_history=1 */;\n"); check_io(md_result_file); } if (opt_lock) @@ -4631,7 +4631,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key, } if (versioned && !opt_xml && opt_dump_history) { - fprintf(md_result_file,"/*!101100 SET system_versioning_insert_history=1 */;\n"); + fprintf(md_result_file,"/*!101100 SET system_versioning_insert_history=@old_system_versioning_insert_history */;\n"); check_io(md_result_file); } mysql_free_result(res); diff --git a/mysql-test/suite/versioning/r/data.result b/mysql-test/suite/versioning/r/data.result index e12520864ca31..045d61b599427 100644 --- a/mysql-test/suite/versioning/r/data.result +++ b/mysql-test/suite/versioning/r/data.result @@ -93,10 +93,10 @@ CREATE TABLE `t1` ( `x` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING; /*!40101 SET character_set_client = @saved_cs_client */; -/*!101100 SET system_versioning_insert_history=1 */; +/*!101100 SET @old_system_versioning_insert_history=@@session.system_versioning_insert_history, @@session.system_versioning_insert_history=1 */; INSERT INTO `t1` (`x`, row_start, row_end) VALUES (1,'2010-10-10 10:10:10.101010','2011-11-11 11:11:11.111111'), (2,'2010-10-10 10:10:10.101010','2038-01-19 03:14:07.999999'); -/*!101100 SET system_versioning_insert_history=1 */; +/*!101100 SET system_versioning_insert_history=@old_system_versioning_insert_history */; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t2` ( @@ -106,10 +106,10 @@ CREATE TABLE `t2` ( PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING; /*!40101 SET character_set_client = @saved_cs_client */; -/*!101100 SET system_versioning_insert_history=1 */; +/*!101100 SET @old_system_versioning_insert_history=@@session.system_versioning_insert_history, @@session.system_versioning_insert_history=1 */; INSERT INTO `t2` (`x`, `row_start`, `row_end`) VALUES (1,'2010-10-10 10:10:10.101010','2011-11-11 11:11:11.111111'), (2,'2010-10-10 10:10:10.101010','2038-01-19 03:14:07.999999'); -/*!101100 SET system_versioning_insert_history=1 */; +/*!101100 SET system_versioning_insert_history=@old_system_versioning_insert_history */; mysqldump: --dump-history can't be used with --as-of. mysqldump: --dump-history can't be used with --replace. mysqldump: --xml can't be used with --dump-history.