[MDEV-29736] mysqldump sets system_versioning_insert_history=1 twice and doesn't restore previous value Created: 2022-10-07  Updated: 2022-10-26  Resolved: 2022-10-26

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: N/A
Fix Version/s: 10.11.1

Type: Bug Priority: Critical
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-16029 mysqldump: dump and restore historica... Closed
Relates
relates to MDEV-16546 System versioning setting to allow hi... Closed

 Description   

Usually mysqldump stores session variable values before changing them, and restores later.

With system_versioning_insert_history, it behaves differently. It sets it to 1 before dumping contents of each versioned table, without storing the previous value, and then sets it to 1 again after dumping the contents. So, it's two SET system_versioning_insert_history=1 per each versioned table. Even if not storing/restoring the previous value is intentional, the second SET is redundant.

create table t1 (a int) with system versioning;
insert into t1 values (1);
 
--let $datadir=`select @@datadir`
--exec $MYSQL_DUMP --dump-history test
 
# Cleanup
drop table t1;

bb-10.11-MDEV-16546 2b1d324294

/*!101100 SET system_versioning_insert_history=1 */;
LOCK TABLES `t1` WRITE;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
INSERT INTO `t1` (`a`, row_start, row_end) VALUES (1,'2022-10-07 12:22:46.461328','2038-01-19 03:14:07.999999');
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
UNLOCK TABLES;
/*!101100 SET system_versioning_insert_history=1 */;


Generated at Thu Feb 08 10:10:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.