mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-16328 ALTER TABLE…page_compression_level should not rebuild table
The table option page_compression_level is something that only affects future writes, not actually the data format. Therefore, we can allow instant changes of this option. Similarly, the table option page_compressed can be set on a previously uncompressed table without rebuilding the table, because an uncompressed page would be considered valid when reading a page_compressed table. Removing the page_compressed option will continue to require the table to be rebuilt. ha_innobase_inplace_ctx::page_compression_level: The requested page_compression_level at the start of ALTER TABLE, or 0 if page_compressed=OFF. alter_options_need_rebuild(): Renamed from create_option_need_rebuild(). Allow page_compression_level and page_compressed to be changed as above, without rebuilding the table. ha_innobase::check_if_supported_inplace_alter(): Allow ALGORITHM=INSTANT for ALTER_OPTIONS if the table is not to be rebuilt. If rebuild is needed, set ha_alter_info->unsupported_reason. innobase_page_compression_try(): Update SYS_TABLES.TYPE according to the table flags, for an instant change of page_compression_level or page_compressed. commit_cache_norebuild(): Adjust dict_table_t::flags, fil_space_t::flags and (if needed) FSP_SPACE_FLAGS if page_compression_level was specified.
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/not_embedded.inc
|
||||
|
||||
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
|
||||
|
||||
# zlib
|
||||
set global innodb_compression_algorithm = 1;
|
||||
|
||||
@ -78,9 +76,14 @@ select count(*) from innodb_page_compressed7 where c1 < 500000;
|
||||
select count(*) from innodb_page_compressed8 where c1 < 500000;
|
||||
select count(*) from innodb_page_compressed9 where c1 < 500000;
|
||||
|
||||
alter table innodb_normal page_compressed=1 page_compression_level=8;
|
||||
alter table innodb_normal page_compressed=1 page_compression_level=8,
|
||||
algorithm=instant;
|
||||
show warnings;
|
||||
show create table innodb_normal;
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=instant;
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||
alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0, algorithm=nocopy;
|
||||
alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0;
|
||||
show warnings;
|
||||
show create table innodb_compressed;
|
||||
@ -187,8 +190,3 @@ drop table innodb_page_compressed6;
|
||||
drop table innodb_page_compressed7;
|
||||
drop table innodb_page_compressed8;
|
||||
drop table innodb_page_compressed9;
|
||||
|
||||
# reset system
|
||||
--disable_query_log
|
||||
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
|
||||
--enable_query_log
|
||||
|
Reference in New Issue
Block a user