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

MDEV-35144 CREATE TABLE ... LIKE uses current innodb_compression_default instead of the create value

When adding a column or index that uses plugin-defined
sysvar-based options with CREATE ... LIKE the server
was using the current value of the sysvar, not the default one.

Because parse_option_list() function was used both in create
and open and it tried to guess when it's create (need to use
current sysvar value and add a new name=value pair to the list)
or open (need to use default, without extending the list).

Let's move the list extending functionality into a separate
function and call it explicitly when needed. Operations that
add new objects (CREATE, ALTER ... ADD) will extend the list,
other operations (ALTER, CREATE ... LIKE, open) will not.
This commit is contained in:
Sergei Golubchik
2024-10-17 15:57:03 +02:00
parent 600c42ea86
commit 3da565c41d
9 changed files with 184 additions and 77 deletions

View File

@ -340,5 +340,39 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si
1001 1 9223372036854775806 1 1 1000 0 0
drop sequence s1,s2;
#
# End of 10.5 tests
# MDEV-35144 CREATE TABLE ... LIKE uses current innodb_compression_default instead of the create value
#
set @@innodb_compression_default= off;
create or replace sequence s engine=innodb;
set @@innodb_compression_default= on;
create or replace table s_import like s;
show create table s;
Table Create Table
s CREATE TABLE `s` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1
show create table s_import;
Table Create Table
s_import CREATE TABLE `s_import` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1
alter table s_import discard tablespace;
flush table s for export;
UNLOCK TABLES;
alter table s_import import tablespace;
drop table s,s_import;
# End of 10.5 tests

View File

@ -239,5 +239,23 @@ drop sequence s1,s2;
--enable_ps_protocol
--echo #
--echo # End of 10.5 tests
--echo # MDEV-35144 CREATE TABLE ... LIKE uses current innodb_compression_default instead of the create value
--echo #
set @@innodb_compression_default= off;
create or replace sequence s engine=innodb;
set @@innodb_compression_default= on;
create or replace table s_import like s;
show create table s;
show create table s_import;
alter table s_import discard tablespace;
flush table s for export;
--copy_file $MYSQLD_DATADIR/test/s.ibd $MYSQLD_DATADIR/test/s_import.ibd
--copy_file $MYSQLD_DATADIR/test/s.cfg $MYSQLD_DATADIR/test/s_import.cfg
UNLOCK TABLES;
alter table s_import import tablespace;
drop table s,s_import;
--echo # End of 10.5 tests