mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-36038 ALTER TABLE…SEQUENCE does not work correctly with InnoDB
mysql_alter_table(): Consider ha_sequence::storage_ht() when determining if the storage engine changed. ha_sequence::check_if_supported_inplace_alter(): A new function, to ensure that ha_innobase::check_if_supported_inplace_alter() will be called on ALTER TABLE name_of_sequence SEQUENCE=0. ha_innobase::check_if_supported_inplace_alter(): For any change of the SEQUENCE attribute, always return HA_ALTER_INPLACE_NOT_SUPPORTED, forcing ALGORITHM=COPY.
This commit is contained in:
committed by
Sergei Golubchik
parent
94ef07d61e
commit
5ebff6e15a
1
mysql-test/suite/sql_sequence/alter.opt
Normal file
1
mysql-test/suite/sql_sequence/alter.opt
Normal file
@ -0,0 +1 @@
|
||||
--innodb-sys-tables
|
@ -166,6 +166,32 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si
|
||||
select next value for t1;
|
||||
next value for t1
|
||||
11
|
||||
$check_innodb_flags;
|
||||
is_sequence
|
||||
12288
|
||||
alter table t1 sequence=0;
|
||||
begin;
|
||||
delete from t1;
|
||||
rollback;
|
||||
$check_innodb_flags;
|
||||
is_sequence
|
||||
0
|
||||
alter table t1 sequence=1;
|
||||
$check_innodb_flags;
|
||||
is_sequence
|
||||
12288
|
||||
alter table t1 sequence=0, algorithm=copy;
|
||||
$check_innodb_flags;
|
||||
is_sequence
|
||||
0
|
||||
alter table t1 sequence=1, algorithm=inplace;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: SEQUENCE. Try ALGORITHM=COPY
|
||||
alter table t1 sequence=1, algorithm=copy;
|
||||
$check_innodb_flags;
|
||||
is_sequence
|
||||
12288
|
||||
alter table t1 sequence=0, algorithm=inplace;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: SEQUENCE. Try ALGORITHM=COPY
|
||||
drop sequence t1;
|
||||
#
|
||||
# ALTER TABLE
|
||||
|
@ -80,6 +80,25 @@ alter sequence t1 start=100;
|
||||
show create sequence t1;
|
||||
select * from t1;
|
||||
select next value for t1;
|
||||
let $check_innodb_flags =
|
||||
select flag & 12288 is_sequence from information_schema.innodb_sys_tables
|
||||
where name='test/t1';
|
||||
evalp $check_innodb_flags;
|
||||
alter table t1 sequence=0;
|
||||
begin;
|
||||
delete from t1;
|
||||
rollback;
|
||||
evalp $check_innodb_flags;
|
||||
alter table t1 sequence=1;
|
||||
evalp $check_innodb_flags;
|
||||
alter table t1 sequence=0, algorithm=copy;
|
||||
evalp $check_innodb_flags;
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
alter table t1 sequence=1, algorithm=inplace;
|
||||
alter table t1 sequence=1, algorithm=copy;
|
||||
evalp $check_innodb_flags;
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
alter table t1 sequence=0, algorithm=inplace;
|
||||
drop sequence t1;
|
||||
|
||||
--echo #
|
||||
|
Reference in New Issue
Block a user