Skip to content

Commit

Permalink
MDEV-29736 mysqldump sets system_versioning_insert_history=1 twice an…
Browse files Browse the repository at this point in the history
…d doesn't restore previous value
  • Loading branch information
vuvova committed Oct 26, 2022
1 parent 73b2a32 commit a6f9694
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions client/mysqldump.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions mysql-test/suite/versioning/r/data.result
Expand Up @@ -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` (
Expand All @@ -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.
Expand Down

0 comments on commit a6f9694

Please sign in to comment.