1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-32350 Can't selectively restore sequences using innodb tables from backup

Added support for sequences to do  discard and import tablespace
This commit is contained in:
Monty
2024-10-08 18:20:46 +03:00
parent ee908140ac
commit 2c52fdd28a
5 changed files with 131 additions and 4 deletions

View File

@ -301,3 +301,44 @@ drop sequence s;
#
# End of 10.4 tests
#
#
# MDEV-32350 Can't selectively restore sequences using innodb tables from
# backup
#
create sequence s2 engine=innodb;
alter table s2 discard tablespace;
SELECT NEXTVAL(s2);
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
create sequence s1 engine=innodb;
select * from s1;
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
flush tables s1 for export;
unlock tables;
select * from s2;
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
SELECT NEXTVAL(s2);
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
alter sequence s2 restart;
ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
alter table s2 import tablespace;
select * from s2;
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
SELECT NEXTVAL(s2);
NEXTVAL(s2)
1
select NEXTVAL(s1);
NEXTVAL(s1)
1
flush table s1,s2;
select * from s1;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1001 1 9223372036854775806 1 1 1000 0 0
select * from s2;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1001 1 9223372036854775806 1 1 1000 0 0
drop sequence s1,s2;
#
# End of 10.5 tests
#

View File

@ -202,3 +202,42 @@ drop sequence s;
--echo #
--echo # End of 10.4 tests
--echo #
--echo #
--echo # MDEV-32350 Can't selectively restore sequences using innodb tables from
--echo # backup
--echo #
--disable_ps_protocol
create sequence s2 engine=innodb;
alter table s2 discard tablespace;
--error ER_GET_ERRNO
SELECT NEXTVAL(s2);
create sequence s1 engine=innodb;
select * from s1;
flush tables s1 for export;
--let $MYSQLD_DATADIR= `select @@datadir`
--move_file $MYSQLD_DATADIR/test/s1.cfg $MYSQLD_DATADIR/test/s2.cfg
--copy_file $MYSQLD_DATADIR/test/s1.ibd $MYSQLD_DATADIR/test/s2.ibd
unlock tables;
--error ER_GET_ERRNO
select * from s2;
--error ER_GET_ERRNO
SELECT NEXTVAL(s2);
--error ER_GET_ERRNO
alter sequence s2 restart;
alter table s2 import tablespace;
select * from s2;
SELECT NEXTVAL(s2);
select NEXTVAL(s1);
flush table s1,s2;
select * from s1;
select * from s2;
drop sequence s1,s2;
--enable_ps_protocol
--echo #
--echo # End of 10.5 tests
--echo #