mirror of
https://github.com/MariaDB/server.git
synced 2025-02-22 21:33:08 +01:00

- Original patch was contributed by Jani Tolonen <jani.k.tolonen@gmail.com> https://github.com/an3l/server/commits/bb-10.3-anel-MDEV-21786-dump-sequence which distinguishes data structure (linked list) of sequences from tables. - Added standard sql output to prevent future changes of sequences and disabled locks for sequences. - Added test case for `MDEV-20070: mysqldump won't work correct on sequences` where table column depends on sequence value. - Restore sequence last value in the following way: - Find `next_not_cached_value` and use it to `setval()` - We just need for logical restore, so don't execute `setval()` - `setval()` should be showed also in case of `--no-data` option. Reviewed-by: daniel@mariadb.org
25 lines
1 KiB
Text
25 lines
1 KiB
Text
CREATE SEQUENCE a1 engine=aria;
|
|
CREATE TABLE t1(a INT, KEY (a)) KEY_BLOCK_SIZE=1024;
|
|
insert into t1 values (1),(2);
|
|
CREATE SEQUENCE x1 engine=innodb;
|
|
CREATE SEQUENCE `a1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=Aria;
|
|
SELECT SETVAL(`a1`, 1, 0);
|
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
|
/*!40101 SET character_set_client = utf8 */;
|
|
CREATE TABLE `t1` (
|
|
`a` int(11) DEFAULT NULL,
|
|
KEY `a` (`a`)
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1024;
|
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
|
INSERT INTO `t1` VALUES (1),(2);
|
|
CREATE SEQUENCE `x1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 cache 1000 nocycle ENGINE=InnoDB;
|
|
SELECT SETVAL(`x1`, 1, 0);
|
|
DROP TABLE a1,t1,x1;
|
|
set default_storage_engine=InnoDB;
|
|
create sequence t1;
|
|
LOCK TABLES t1 READ;
|
|
SELECT * FROM t1;
|
|
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
|
|
1 1 9223372036854775806 1 1 1000 0 0
|
|
unlock tables;
|
|
drop table t1;
|