mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
ALTER TABLE and replication should convert old row_end timestamps to new timestamp range
MDEV-32188 make TIMESTAMP use whole 32-bit unsigned range - Added --update-history option to mariadb-dump to change 2038 row_end timestamp to 2106. - Updated ALTER TABLE ... to convert old row_end timestamps to 2106 timestamp for tables created before MariaDB 11.4.0. - Fixed bug in CHECK TABLE where we wrongly suggested to USE REPAIR TABLE when ALTER TABLE...FORCE is needed. - mariadb-check printed table names that where used with REPAIR TABLE but did not print table names used with ALTER TABLE or with name repair. Fixed by always printing a table that is fixed if --silent is not used. - Added TABLE::vers_fix_old_timestamp() that will change max-timestamp for versioned tables when replication from a pre-11.4.0 server. A few test cases changed. This is caused by: - CHECK TABLE now prints 'Please do ALTER TABLE... instead of 'Please do REPAIR TABLE' when there is a problem with the information in the .frm file (for example a very old frm file). - mariadb-check now prints repaired table names. - mariadb-check also now prints nicer error message in case ALTER TABLE is needed to repair a table.
This commit is contained in:
106
mysql-test/suite/versioning/r/old_timestamp.result
Normal file
106
mysql-test/suite/versioning/r/old_timestamp.result
Normal file
@@ -0,0 +1,106 @@
|
||||
/*!999999\- enable the sandbox mode */
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `sv_basic` (
|
||||
`a` int(11) NOT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!101100 SET @old_system_versioning_insert_history=@@session.system_versioning_insert_history, @@session.system_versioning_insert_history=1 */;
|
||||
INSERT INTO `sv_basic` (`a`, row_start, row_end) VALUES (1,'2023-12-19 14:23:22.304434','2038-01-19 03:14:07.999999'),
|
||||
(2,'2023-12-19 14:23:22.304434','2023-12-19 14:23:22.305292'),
|
||||
(3,'2023-12-19 14:23:22.304434','2038-01-19 03:14:07.999999');
|
||||
/*!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 `sv_explicit` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`row_foo_start` timestamp(6) GENERATED ALWAYS AS ROW START,
|
||||
`row_foo_end` timestamp(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (`row_foo_start`, `row_foo_end`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!101100 SET @old_system_versioning_insert_history=@@session.system_versioning_insert_history, @@session.system_versioning_insert_history=1 */;
|
||||
INSERT INTO `sv_explicit` VALUES
|
||||
(1,'2023-12-19 14:23:22.358302','2038-01-19 03:14:07.999999'),
|
||||
(2,'2023-12-19 14:23:22.358302','2023-12-19 14:23:22.359113'),
|
||||
(3,'2023-12-19 14:23:22.358302','2038-01-19 03:14:07.999999');
|
||||
/*!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 `sv_partition` (
|
||||
`a` int(11) NOT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
PARTITION BY SYSTEM_TIME
|
||||
(PARTITION `p_hist` HISTORY ENGINE = MyISAM,
|
||||
PARTITION `p_cur` CURRENT ENGINE = MyISAM);
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!101100 SET @old_system_versioning_insert_history=@@session.system_versioning_insert_history, @@session.system_versioning_insert_history=1 */;
|
||||
INSERT INTO `sv_partition` (`a`, row_start, row_end) VALUES (2,'2023-12-19 14:23:22.331143','2023-12-19 14:23:22.332359'),
|
||||
(1,'2023-12-19 14:23:22.331143','2038-01-19 03:14:07.999999'),
|
||||
(3,'2023-12-19 14:23:22.331143','2038-01-19 03:14:07.999999');
|
||||
/*!101100 SET system_versioning_insert_history=@old_system_versioning_insert_history */;
|
||||
/*!999999\- enable the sandbox mode */
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `sv_basic` (
|
||||
`a` int(11) NOT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!101100 SET @old_system_versioning_insert_history=@@session.system_versioning_insert_history, @@session.system_versioning_insert_history=1 */;
|
||||
INSERT INTO `sv_basic` (`a`, row_start, row_end) VALUES (1,'2023-12-19 14:23:22.304434','2106-02-07 06:28:15.999999'),
|
||||
(2,'2023-12-19 14:23:22.304434','2023-12-19 14:23:22.305292'),
|
||||
(3,'2023-12-19 14:23:22.304434','2106-02-07 06:28:15.999999');
|
||||
/*!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 `sv_explicit` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`row_foo_start` timestamp(6) GENERATED ALWAYS AS ROW START,
|
||||
`row_foo_end` timestamp(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (`row_foo_start`, `row_foo_end`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!101100 SET @old_system_versioning_insert_history=@@session.system_versioning_insert_history, @@session.system_versioning_insert_history=1 */;
|
||||
INSERT INTO `sv_explicit` VALUES
|
||||
(1,'2023-12-19 14:23:22.358302','2106-02-07 06:28:15.999999'),
|
||||
(2,'2023-12-19 14:23:22.358302','2023-12-19 14:23:22.359113'),
|
||||
(3,'2023-12-19 14:23:22.358302','2106-02-07 06:28:15.999999');
|
||||
/*!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 `sv_partition` (
|
||||
`a` int(11) NOT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
PARTITION BY SYSTEM_TIME
|
||||
(PARTITION `p_hist` HISTORY ENGINE = MyISAM,
|
||||
PARTITION `p_cur` CURRENT ENGINE = MyISAM);
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!101100 SET @old_system_versioning_insert_history=@@session.system_versioning_insert_history, @@session.system_versioning_insert_history=1 */;
|
||||
INSERT INTO `sv_partition` (`a`, row_start, row_end) VALUES (2,'2023-12-19 14:23:22.331143','2023-12-19 14:23:22.332359'),
|
||||
(1,'2023-12-19 14:23:22.331143','2106-02-07 06:28:15.999999'),
|
||||
(3,'2023-12-19 14:23:22.331143','2106-02-07 06:28:15.999999');
|
||||
/*!101100 SET system_versioning_insert_history=@old_system_versioning_insert_history */;
|
||||
test.sv_basic Needs upgrade with ALTER TABLE FORCE
|
||||
test.sv_explicit Needs upgrade with ALTER TABLE FORCE
|
||||
test.sv_partition Needs upgrade with ALTER TABLE FORCE
|
||||
set @@time_zone="+00:00";
|
||||
select a,row_end from sv_basic for system_time all;
|
||||
a row_end
|
||||
1 2106-02-07 06:28:15.999999
|
||||
2 2023-12-19 14:23:22.305292
|
||||
3 2106-02-07 06:28:15.999999
|
||||
select a,row_end from sv_partition for system_time all;
|
||||
a row_end
|
||||
1 2106-02-07 06:28:15.999999
|
||||
2 2023-12-19 14:23:22.332359
|
||||
3 2106-02-07 06:28:15.999999
|
||||
select a,row_foo_end from sv_explicit for system_time all;
|
||||
a row_foo_end
|
||||
1 2106-02-07 06:28:15.999999
|
||||
2 2023-12-19 14:23:22.359113
|
||||
3 2106-02-07 06:28:15.999999
|
||||
drop table sv_basic,sv_partition,sv_explicit;
|
||||
Reference in New Issue
Block a user