mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-23497 Make ROW_FORMAT=COMPRESSED read-only by default
Let us introduce the parameter innodb_read_only_compressed that is ON by default, making any ROW_FORMAT=COMPRESSED tables read-only. I developed the ROW_FORMAT=COMPRESSED format based on Heikki Tuuri's rough design between 2005 and 2008. It might have been a good idea back then, but no proper benchmarks were ever run to validate the design or the implementation. The format has been more or less obsolete for years. It limits innodb_page_size to 16384 bytes (the default), and instant ALTER TABLE is not supported. This is the first step towards deprecating and removing write support for ROW_FORMAT=COMPRESSED tables.
This commit is contained in:
@@ -24,6 +24,10 @@ SELECT * FROM information_schema.innodb_cmp_per_index_reset;
|
||||
# see that the table is empty
|
||||
SELECT * FROM information_schema.innodb_cmp_per_index;
|
||||
|
||||
--disable_query_log
|
||||
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
|
||||
SET GLOBAL innodb_read_only_compressed=OFF;
|
||||
--enable_query_log
|
||||
# create a table that uses compression
|
||||
CREATE TABLE t (
|
||||
a INT,
|
||||
@@ -57,6 +61,9 @@ while ($i)
|
||||
COMMIT;
|
||||
|
||||
ALTER TABLE t DROP INDEX c;
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
|
||||
--enable_query_log
|
||||
|
||||
GRANT USAGE ON *.* TO 'tuser01'@'localhost' IDENTIFIED BY 'cDJvI9s_Uq';
|
||||
FLUSH PRIVILEGES;
|
||||
|
@@ -6,6 +6,8 @@ SET default_storage_engine=InnoDB;
|
||||
|
||||
--disable_query_log
|
||||
call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is");
|
||||
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
|
||||
SET GLOBAL innodb_read_only_compressed=OFF;
|
||||
--enable_query_log
|
||||
|
||||
let $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
|
||||
@@ -402,7 +404,9 @@ create table worklog5743(a TEXT not null) ROW_FORMAT=COMPACT;
|
||||
-- error ER_INDEX_COLUMN_TOO_LONG
|
||||
create index idx on worklog5743(a(768));
|
||||
create index idx2 on worklog5743(a(767));
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
|
||||
--enable_query_log
|
||||
drop table worklog5743;
|
||||
|
||||
|
||||
eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
|
||||
|
@@ -6,6 +6,8 @@ SET default_storage_engine=InnoDB;
|
||||
|
||||
--disable_query_log
|
||||
call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is");
|
||||
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
|
||||
SET GLOBAL innodb_read_only_compressed=OFF;
|
||||
--enable_query_log
|
||||
|
||||
let $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
|
||||
@@ -154,14 +156,12 @@ show warnings;
|
||||
|
||||
# Test edge cases for indexes using key_block_size=2
|
||||
SET sql_mode= '';
|
||||
--error ER_TOO_BIG_ROWSIZE
|
||||
create index idx1 on worklog5743_2(a2(4000));
|
||||
show warnings;
|
||||
show create table worklog5743_2;
|
||||
create index idx3 on worklog5743_2(a2(769));
|
||||
show warnings;
|
||||
create index idx4 on worklog5743_2(a2(768));
|
||||
show warnings;
|
||||
-- error ER_TOO_LONG_KEY
|
||||
create index idx5 on worklog5743_2(a1, a2(765));
|
||||
show warnings;
|
||||
create index idx6 on worklog5743_2(a1, a2(764));
|
||||
@@ -174,7 +174,6 @@ create index idx3 on worklog5743_4(a2(769));
|
||||
show warnings;
|
||||
create index idx4 on worklog5743_4(a2(768));
|
||||
show warnings;
|
||||
-- error ER_TOO_LONG_KEY
|
||||
create index idx5 on worklog5743_4(a1, a2(765));
|
||||
show warnings;
|
||||
create index idx6 on worklog5743_4(a1, a2(764));
|
||||
@@ -272,7 +271,6 @@ show warnings;
|
||||
drop table worklog5743;
|
||||
|
||||
create table worklog5743(a1 int, a2 varchar(769)) ROW_FORMAT=DYNAMIC;
|
||||
-- error ER_TOO_LONG_KEY
|
||||
create index idx1 on worklog5743(a2);
|
||||
show warnings;
|
||||
drop table worklog5743;
|
||||
@@ -285,7 +283,6 @@ update worklog5743 set a1 = 3333;
|
||||
drop table worklog5743;
|
||||
|
||||
create table worklog5743(a1 int, a2 varchar(765)) ROW_FORMAT=DYNAMIC;
|
||||
-- error ER_TOO_LONG_KEY
|
||||
create index idx1 on worklog5743(a1, a2);
|
||||
show warnings;
|
||||
drop table worklog5743;
|
||||
@@ -316,10 +313,6 @@ rollback;
|
||||
drop table worklog5743;
|
||||
|
||||
-- echo ### Test 6 ###
|
||||
# Create a table with old format, and the limit is 768 bytes.
|
||||
-- error ER_TOO_LONG_KEY
|
||||
create table worklog5743(a TEXT not null, primary key (a(1000)));
|
||||
|
||||
create table worklog5743(a TEXT) ROW_FORMAT=COMPACT;
|
||||
|
||||
# Excercise the column length check in ha_innobase::add_index()
|
||||
@@ -383,7 +376,9 @@ create table worklog5743(a TEXT not null) ROW_FORMAT=COMPACT;
|
||||
-- error ER_INDEX_COLUMN_TOO_LONG
|
||||
create index idx on worklog5743(a(768));
|
||||
create index idx2 on worklog5743(a(767));
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
|
||||
--enable_query_log
|
||||
drop table worklog5743;
|
||||
|
||||
|
||||
eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
|
||||
|
@@ -6,6 +6,8 @@ SET default_storage_engine=InnoDB;
|
||||
|
||||
--disable_query_log
|
||||
call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is");
|
||||
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
|
||||
SET GLOBAL innodb_read_only_compressed=OFF;
|
||||
--enable_query_log
|
||||
|
||||
let $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
|
||||
@@ -396,7 +398,9 @@ create table worklog5743(a TEXT not null) ROW_FORMAT=COMPACT;
|
||||
-- error ER_INDEX_COLUMN_TOO_LONG
|
||||
create index idx on worklog5743(a(768));
|
||||
create index idx2 on worklog5743(a(767));
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
|
||||
--enable_query_log
|
||||
drop table worklog5743;
|
||||
|
||||
|
||||
eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
|
||||
|
@@ -81,6 +81,10 @@ INSERT INTO t1 VALUES (1, '');
|
||||
UPDATE t1 SET c2=@longblob;
|
||||
DROP TABLE t1;
|
||||
|
||||
--disable_query_log
|
||||
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
|
||||
SET GLOBAL innodb_read_only_compressed=OFF;
|
||||
--enable_query_log
|
||||
--echo #
|
||||
--echo # Separate tablespace, Row Format = Compressed, Key Block Size = 2k
|
||||
--echo #
|
||||
@@ -103,6 +107,9 @@ CREATE TABLE t1 (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1;
|
||||
INSERT INTO t1 VALUES (1, '');
|
||||
UPDATE t1 SET c2=@longblob;
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
|
||||
--enable_query_log
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
|
@@ -15,6 +15,11 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_innodb_16k.inc
|
||||
|
||||
--disable_query_log
|
||||
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
|
||||
SET GLOBAL innodb_read_only_compressed=OFF;
|
||||
--enable_query_log
|
||||
|
||||
call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is');
|
||||
# Prefix index with VARCHAR data type , primary/secondary index and DML ops
|
||||
CREATE TABLE worklog5743 (
|
||||
@@ -1325,4 +1330,7 @@ ALTER TABLE worklog5743 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE;
|
||||
ALTER TABLE worklog5743 ROW_FORMAT=REDUNDANT, ALGORITHM=COPY;
|
||||
--disable_info
|
||||
SHOW CREATE TABLE worklog5743;
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
|
||||
--enable_query_log
|
||||
DROP TABLE worklog5743;
|
||||
|
@@ -23,6 +23,9 @@ let $innodb_compression_level = `SELECT @@global.innodb_compression_level`;
|
||||
SET GLOBAL innodb_file_per_table=on;
|
||||
SET GLOBAL innodb_cmp_per_index_enabled=ON;
|
||||
SET GLOBAL innodb_compression_level=0;
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_read_only_compressed=OFF;
|
||||
--enable_query_log
|
||||
|
||||
--echo #******************************************************************
|
||||
--echo # Test 1-1K: innodb_cmp_per_index_enabled=ON and innodb_compression_level=0 with page size 1K
|
||||
@@ -65,6 +68,9 @@ SET @inl_val=2;
|
||||
|
||||
--echo # set the flag on (default off)
|
||||
SET GLOBAL innodb_cmp_per_index_enabled=ON;
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_read_only_compressed=OFF;
|
||||
--enable_query_log
|
||||
|
||||
--echo # set the flags
|
||||
SET GLOBAL innodb_file_per_table=on;
|
||||
@@ -151,6 +157,9 @@ DROP TABLE tab5;
|
||||
--echo # reset the stat table before starting next testcase
|
||||
SET GLOBAL innodb_cmp_per_index_enabled=0;
|
||||
SET GLOBAL innodb_cmp_per_index_enabled=1;
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_read_only_compressed=OFF;
|
||||
--enable_query_log
|
||||
|
||||
--echo # create a table with page size=4K
|
||||
--echo # create indexes on each column.(total 9 indexes)
|
||||
@@ -359,6 +368,9 @@ DROP TABLE tab5;
|
||||
--echo # reset the stat table before starting next testcase
|
||||
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
|
||||
SET GLOBAL innodb_cmp_per_index_enabled=ON;
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_read_only_compressed=OFF;
|
||||
--enable_query_log
|
||||
|
||||
--echo # create a table with page size=2K
|
||||
--echo # create indexes on each column.(total 9 indexes)
|
||||
@@ -424,6 +436,9 @@ DROP TABLE tab5;
|
||||
--echo # reset the stat table before starting next testcase
|
||||
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
|
||||
SET GLOBAL innodb_cmp_per_index_enabled=ON;
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_read_only_compressed=OFF;
|
||||
--enable_query_log
|
||||
|
||||
--echo # create a table with page size=4K
|
||||
--echo # create indexes on each column.(total 9 indexes)
|
||||
@@ -855,6 +870,9 @@ DROP TABLE tab5;
|
||||
--echo # reset the stat table before starting next testcase
|
||||
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
|
||||
SET GLOBAL innodb_cmp_per_index_enabled=ON;
|
||||
--disable_query_log
|
||||
SET GLOBAL innodb_read_only_compressed=OFF;
|
||||
--enable_query_log
|
||||
|
||||
--echo # create a table with page size=2K
|
||||
--echo # create indexes on each column.(total 9 indexes)
|
||||
@@ -1115,6 +1133,10 @@ DROP TABLE tab5;
|
||||
SET GLOBAL innodb_cmp_per_index_enabled=OFF;
|
||||
SET GLOBAL innodb_cmp_per_index_enabled=ON;
|
||||
SET GLOBAL innodb_compression_failure_threshold_pct=10;
|
||||
--disable_query_log
|
||||
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
|
||||
SET GLOBAL innodb_read_only_compressed=OFF;
|
||||
--enable_query_log
|
||||
|
||||
--echo # create a table with page size=2K
|
||||
--echo # create indexes on each column.(total 9 indexes)
|
||||
@@ -1333,5 +1355,6 @@ eval SET GLOBAL innodb_file_per_table=default;
|
||||
eval SET GLOBAL innodb_cmp_per_index_enabled=default;
|
||||
--disable_query_log
|
||||
eval SET GLOBAL innodb_compression_level=$innodb_compression_level;
|
||||
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
|
||||
--enable_query_log
|
||||
eval SET GLOBAL innodb_compression_failure_threshold_pct=default;
|
||||
|
Reference in New Issue
Block a user