1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +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:
Marko Mäkelä
2020-11-10 17:21:16 +02:00
parent c498250888
commit 9bc874a594
65 changed files with 396 additions and 192 deletions

View File

@ -8,9 +8,12 @@ innodb-buffer-pool-size=24M
[16k] [16k]
innodb-page-size=16K innodb-page-size=16K
--skip-innodb-read-only-compressed
[8k] [8k]
innodb-page-size=8K innodb-page-size=8K
--skip-innodb-read-only-compressed
[4k] [4k]
innodb-page-size=4K innodb-page-size=4K
--skip-innodb-read-only-compressed

View File

@ -1,8 +1,11 @@
[16k] [16k]
innodb-page-size=16K innodb-page-size=16K
skip-innodb-read-only-compressed
[8k] [8k]
innodb-page-size=8K innodb-page-size=8K
skip-innodb-read-only-compressed
[4k] [4k]
innodb-page-size=4K innodb-page-size=4K
skip-innodb-read-only-compressed

View File

@ -41,9 +41,12 @@ SET @old_innodb_file_per_table = @@global.innodb_file_per_table;
SET @old_innodb_strict_mode = @@global.innodb_strict_mode; SET @old_innodb_strict_mode = @@global.innodb_strict_mode;
SET @@global.innodb_file_per_table = ON, SET @@global.innodb_file_per_table = ON,
@@global.innodb_strict_mode = ON; @@global.innodb_strict_mode = ON;
--disable_query_log
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
--connect(con1,localhost,root,,) --connect(con1,localhost,root,,)
CREATE TABLE t1 (id INT NOT NULL CREATE TABLE t1 (id INT NOT NULL
PRIMARY KEY, PRIMARY KEY,
user_num CHAR(10) user_num CHAR(10)
@ -90,6 +93,9 @@ DROP TABLE t1;
--connection default --connection default
SET @@global.innodb_strict_mode = @old_innodb_strict_mode; SET @@global.innodb_strict_mode = @old_innodb_strict_mode;
SET @@global.innodb_file_per_table = @old_innodb_file_per_table; SET @@global.innodb_file_per_table = @old_innodb_file_per_table;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
# #
# Bug#32430 - show engine innodb status causes errors # Bug#32430 - show engine innodb status causes errors

View File

@ -1,2 +1,3 @@
--plugin-load-add=$EXAMPLE_KEY_MANAGEMENT_SO --plugin-load-add=$EXAMPLE_KEY_MANAGEMENT_SO
--loose-example-key-management --loose-example-key-management
--skip-innodb-read-only-compressed

View File

@ -3,9 +3,11 @@ plugin-load-add=$FILE_KEY_MANAGEMENT_SO
loose-file-key-management loose-file-key-management
loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
file-key-management-encryption-algorithm=aes_cbc file-key-management-encryption-algorithm=aes_cbc
--skip-innodb-read-only-compressed
[ctr] [ctr]
plugin-load-add=$FILE_KEY_MANAGEMENT_SO plugin-load-add=$FILE_KEY_MANAGEMENT_SO
loose-file-key-management loose-file-key-management
loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
file-key-management-encryption-algorithm=aes_ctr file-key-management-encryption-algorithm=aes_ctr
--skip-innodb-read-only-compressed

View File

@ -733,7 +733,14 @@ let $row_format=REDUNDANT;
--source inc/innodb_v_large_col.inc --source inc/innodb_v_large_col.inc
let $row_format=COMPRESSED; let $row_format=COMPRESSED;
--disable_query_log
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
--source inc/innodb_v_large_col.inc --source inc/innodb_v_large_col.inc
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
# Make sure FTS_DOC_ID for FULLTEXT index set with correct column id with # Make sure FTS_DOC_ID for FULLTEXT index set with correct column id with
# virtual columns # virtual columns

View File

@ -5,6 +5,11 @@
--echo # BTR_COPY_BLOB_PREFIX --echo # BTR_COPY_BLOB_PREFIX
--echo # --echo #
--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 TABLE t1 CREATE TABLE t1
( f1 int primary key, f2 blob, ( f1 int primary key, f2 blob,
f3 blob generated always as (f2)) f3 blob generated always as (f2))
@ -12,5 +17,9 @@ CREATE TABLE t1
insert into t1 (f1, f2) values (1, repeat('&', 50000)); insert into t1 (f1, f2) values (1, repeat('&', 50000));
alter table t1 add index i1 (f3(200)) ; alter table t1 add index i1 (f3(200)) ;
alter table t1 row_format=compact; alter table t1 row_format=compact;
drop table t1;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
drop table t1;

View File

@ -253,6 +253,10 @@ SELECT * FROM t1;
CHECK TABLE t1; CHECK TABLE t1;
DROP TABLE t1; 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
CREATE TABLE t1( CREATE TABLE t1(
a VARCHAR(1000) GENERATED ALWAYS AS ('1') VIRTUAL, a VARCHAR(1000) GENERATED ALWAYS AS ('1') VIRTUAL,
b VARCHAR(1000) NOT NULL, b VARCHAR(1000) NOT NULL,
@ -262,6 +266,9 @@ CREATE TABLE t1(
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; ) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
INSERT INTO t1(b) VALUES(REPEAT('b',1000)); INSERT INTO t1(b) VALUES(REPEAT('b',1000));
DELETE FROM t1; DELETE FROM t1;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #

View File

@ -85,11 +85,20 @@ tab InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_for
SELECT * FROM tab; SELECT * FROM tab;
a b a b
1 Check with max column size 1 Check with max column size
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
SET GLOBAL innodb_read_only_compressed=ON;
ALTER TABLE tab ROW_FORMAT=COMPRESSED; ALTER TABLE tab ROW_FORMAT=COMPRESSED;
ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SET GLOBAL innodb_read_only_compressed=OFF;
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
SET GLOBAL innodb_read_only_compressed=ON;
SELECT * FROM tab; SELECT * FROM tab;
a b a b
1 Check with max column size 1 Check with max column size
ALTER TABLE tab ROW_FORMAT=Dynamic; ALTER TABLE tab ROW_FORMAT=Dynamic;
Warnings:
Warning 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
SHOW TABLE STATUS LIKE 'tab'; SHOW TABLE STATUS LIKE 'tab';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
tab InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC 0 N tab InnoDB # Dynamic # # # # # # NULL # NULL NULL latin1_swedish_ci NULL row_format=DYNAMIC 0 N

View File

@ -29,7 +29,7 @@ c71 char(200), c72 char(200), c73 char(200), c74 char(200), c75 char(200),
c76 char(200), c77 char(200), c78 char(200), c79 char(200), c80 char(200), c76 char(200), c77 char(200), c78 char(200), c79 char(200), c80 char(200),
c81 char(63) c81 char(63)
) ROW_FORMAT=compressed; ) ROW_FORMAT=compressed;
ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options") Got one of the listed errors
CREATE TABLE t1 (a varchar(255) character set utf8, CREATE TABLE t1 (a varchar(255) character set utf8,
b varchar(255) character set utf8, b varchar(255) character set utf8,
c varchar(255) character set utf8, c varchar(255) character set utf8,

View File

@ -1,17 +0,0 @@
create table t1(a blob) engine=innodb key_block_size=8;
create function generate_blob()
returns varchar(20000)
begin
declare x varchar(20000) default '';
declare i int default 500;
while i > 0 do
set x = concat(sha1(i), x);
set i = i - 1;
end while;
return x;
end //
insert into t1 select generate_blob();
truncate t1;
insert into t1 select generate_blob();
drop table t1;
drop function generate_blob;

View File

@ -199,7 +199,7 @@ create temporary table t1
(keyc int, c1 char(100), c2 char(100), (keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1) primary key(keyc), index sec_index(c1)
) engine = innodb key_block_size = 4; ) engine = innodb key_block_size = 4;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
create temporary table t1 create temporary table t1
(keyc int, c1 char(100), c2 char(100), (keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1) primary key(keyc), index sec_index(c1)

View File

@ -164,11 +164,11 @@ ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
create temporary table t ( create temporary table t (
i int) i int)
engine = innodb row_format = compressed; engine = innodb row_format = compressed;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
create temporary table t ( create temporary table t (
i int) i int)
engine = innodb row_format = compressed key_block_size = 8; engine = innodb row_format = compressed key_block_size = 8;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
create temporary table t ( create temporary table t (
i int) i int)
engine = innodb row_format = dynamic; engine = innodb row_format = dynamic;
@ -201,7 +201,7 @@ drop table t;
create temporary table t ( create temporary table t (
i int) i int)
engine = innodb row_format = compressed; engine = innodb row_format = compressed;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
#files in MYSQL_TMP_DIR, expecting only default temporary tablespace file #files in MYSQL_TMP_DIR, expecting only default temporary tablespace file
ibtmp1 ibtmp1
create temporary table t ( create temporary table t (
@ -473,19 +473,19 @@ CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
c CHAR(10) NOT NULL c CHAR(10) NOT NULL
) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; ) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TEMPORARY TABLE t1 ( CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
c CHAR(10) NOT NULL c CHAR(10) NOT NULL
) ENGINE = InnoDB KEY_BLOCK_SIZE = 4, ROW_FORMAT = COMPACT; ) ENGINE = InnoDB KEY_BLOCK_SIZE = 4, ROW_FORMAT = COMPACT;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TEMPORARY TABLE t1 ( CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
@ -505,37 +505,37 @@ CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
c CHAR(10) NOT NULL c CHAR(10) NOT NULL
) ENGINE = InnoDB KEY_BLOCK_SIZE = 4; ) ENGINE = InnoDB KEY_BLOCK_SIZE = 4;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TEMPORARY TABLE t1 ( CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
c CHAR(10) NOT NULL c CHAR(10) NOT NULL
) ENGINE = InnoDB ROW_FORMAT = COMPRESSED; ) ENGINE = InnoDB ROW_FORMAT = COMPRESSED;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TEMPORARY TABLE t1 ( CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
c CHAR(10) NOT NULL c CHAR(10) NOT NULL
) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8; ) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 8;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TEMPORARY TABLE t1 ( CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
c CHAR(10) NOT NULL c CHAR(10) NOT NULL
) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 7; ) ENGINE = InnoDB ROW_FORMAT = COMPRESSED KEY_BLOCK_SIZE = 7;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
CREATE TEMPORARY TABLE t1 ( CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
@ -555,22 +555,22 @@ CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY i INT NOT NULL PRIMARY KEY
) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; ) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
ALTER TABLE t1 ROW_FORMAT = COMPRESSED; ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
ALTER TABLE t1 KEY_BLOCK_SIZE = 4; ALTER TABLE t1 KEY_BLOCK_SIZE = 4;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4; ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
ALTER TABLE t1 ROW_FORMAT = DYNAMIC; ALTER TABLE t1 ROW_FORMAT = DYNAMIC;
set innodb_strict_mode = OFF; set innodb_strict_mode = OFF;
@ -613,10 +613,10 @@ Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED is ignored for TEMPORARY TABLE.
Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC. Warning 1478 InnoDB: assuming ROW_FORMAT=DYNAMIC.
set innodb_strict_mode = ON; set innodb_strict_mode = ON;
ALTER TABLE t1 ADD COLUMN j INT; ALTER TABLE t1 ADD COLUMN j INT;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Error 4047 CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. Error 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table

View File

@ -1,11 +1,15 @@
[COPY] [COPY]
--alter_algorithm=copy --alter_algorithm=copy
--skip-innodb-read-only-compressed
[INPLACE] [INPLACE]
--alter_algorithm=inplace --alter_algorithm=inplace
--skip-innodb-read-only-compressed
[NOCOPY] [NOCOPY]
--alter_algorithm=nocopy --alter_algorithm=nocopy
--skip-innodb-read-only-compressed
[INSTANT] [INSTANT]
--alter_algorithm=instant --alter_algorithm=instant
--skip-innodb-read-only-compressed

View File

@ -2,6 +2,10 @@
# MDEV-11757 KEY_BLOCK_SIZE strangeness when UNCOMPRESSing COMPRESSed InnoDB tables # MDEV-11757 KEY_BLOCK_SIZE strangeness when UNCOMPRESSing COMPRESSed InnoDB tables
# #
source include/have_innodb.inc; source include/have_innodb.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
create table t1 ( create table t1 (
id1 bigint(20) not null, id1 bigint(20) not null,
@ -17,6 +21,9 @@ SET innodb_strict_mode=OFF;
alter table t1 row_format=dynamic; alter table t1 row_format=dynamic;
show create table t1; show create table t1;
SET innodb_strict_mode=ON; SET innodb_strict_mode=ON;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
alter table t1 key_block_size=0; alter table t1 key_block_size=0;
show create table t1; show create table t1;
alter table t1 drop primary key, add primary key (id1), alter table t1 drop primary key, add primary key (id1),

View File

@ -147,14 +147,22 @@ SHOW TABLE STATUS LIKE 'tab';
# Check by SELECT, no errors # Check by SELECT, no errors
SELECT * FROM tab; SELECT * FROM tab;
# Check no errors SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
SET GLOBAL innodb_read_only_compressed=ON;
--error ER_UNSUPPORTED_COMPRESSED_TABLE
ALTER TABLE tab ROW_FORMAT=COMPRESSED; ALTER TABLE tab ROW_FORMAT=COMPRESSED;
SET GLOBAL innodb_read_only_compressed=OFF;
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
SET GLOBAL innodb_read_only_compressed=ON;
# Check by SELECT, no errors # Check by SELECT, no errors
SELECT * FROM tab; SELECT * FROM tab;
# Check no errors
ALTER TABLE tab ROW_FORMAT=Dynamic; ALTER TABLE tab ROW_FORMAT=Dynamic;
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
# Check no errors
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # --replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 'tab'; SHOW TABLE STATUS LIKE 'tab';

View File

@ -21,6 +21,10 @@ CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
SHOW TABLE STATUS LIKE 't1'; SHOW TABLE STATUS LIKE 't1';
DROP TABLE t1; 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
CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB CREATE TABLE t1(c1 TEXT,c2 BLOB) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED; ROW_FORMAT=COMPRESSED;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # --replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
@ -28,6 +32,9 @@ SHOW TABLE STATUS LIKE 't1';
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # --replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 #
SHOW TABLE STATUS LIKE 't1'; SHOW TABLE STATUS LIKE 't1';
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
DROP TABLE t1; DROP TABLE t1;
--error 0,ER_CANT_CREATE_TABLE --error 0,ER_CANT_CREATE_TABLE

View File

@ -14,6 +14,11 @@ SELECT @@innodb_file_per_table;
SET SQL_MODE=strict_all_tables; SET SQL_MODE=strict_all_tables;
--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 TABLE tab0 (c1 VARCHAR(65530), KEY(c1(3073))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; CREATE TABLE tab0 (c1 VARCHAR(65530), KEY(c1(3073))) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
SHOW CREATE TABLE tab0; SHOW CREATE TABLE tab0;
DROP TABLE tab0; DROP TABLE tab0;
@ -33,3 +38,7 @@ SELECT @@innodb_strict_mode;
CREATE TABLE tab1(c1 int ) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; CREATE TABLE tab1(c1 int ) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
DROP TABLE tab1; DROP TABLE tab1;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log

View File

@ -1 +1,2 @@
--loose-innodb_sys_tablespaces --loose-innodb_sys_tablespaces
--skip-innodb-read-only-compressed

View File

@ -1 +1,2 @@
--default_storage_engine=InnoDB --default_storage_engine=InnoDB
--skip-innodb-read-only-compressed

View File

@ -20,7 +20,7 @@ SELECT variable_value FROM information_schema.global_status
SET SESSION innodb_strict_mode = ON; SET SESSION innodb_strict_mode = ON;
--replace_regex /> [0-9]*/> max_row_size/ --replace_regex /> [0-9]*/> max_row_size/
--error 1005 --error ER_CANT_CREATE_TABLE,ER_UNSUPPORTED_COMPRESSED_TABLE
CREATE TABLE t1 ( CREATE TABLE t1 (
c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200), c01 char(200), c02 char(200), c03 char(200), c04 char(200), c05 char(200),
c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200), c06 char(200), c07 char(200), c08 char(200), c09 char(200), c10 char(200),

View File

@ -617,6 +617,10 @@ eval DROP DATABASE $dest_db;
--echo # ORPHANED DUE TO RENAME TABLE --echo # ORPHANED DUE TO RENAME TABLE
--echo # --echo #
CREATE DATABASE db1; USE db1; CREATE DATABASE db1; USE db1;
--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 TABLE notes ( CREATE TABLE notes (
id int(11) NOT NULL AUTO_INCREMENT, id int(11) NOT NULL AUTO_INCREMENT,
body text COLLATE utf8_unicode_ci, body text COLLATE utf8_unicode_ci,
@ -627,6 +631,9 @@ ROW_FORMAT=COMPRESSED;
ALTER TABLE notes ADD FULLTEXT INDEX index_ft_body (body(255)); ALTER TABLE notes ADD FULLTEXT INDEX index_ft_body (body(255));
DROP INDEX index_ft_body ON notes; DROP INDEX index_ft_body ON notes;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
CREATE DATABASE db2; CREATE DATABASE db2;
RENAME TABLE db1.notes TO db2.notes; RENAME TABLE db1.notes TO db2.notes;

View File

@ -35,6 +35,10 @@ DROP TABLE t1;
--echo # BTR_COPY_BLOB_PREFIX --echo # BTR_COPY_BLOB_PREFIX
--echo # --echo #
--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 TABLE t1(f1 INT PRIMARY KEY, f3 LINESTRING NOT NULL, CREATE TABLE t1(f1 INT PRIMARY KEY, f3 LINESTRING NOT NULL,
SPATIAL KEY(f3))ENGINE=InnoDB ROW_FORMAT=COMPRESSED SPATIAL KEY(f3))ENGINE=InnoDB ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=1; KEY_BLOCK_SIZE=1;
@ -58,5 +62,7 @@ let $linestr = $linestr 9999 9999);
--eval INSERT INTO t1 VALUES (1, ST_linefromtext(concat('linestring', '$linestr'))); --eval INSERT INTO t1 VALUES (1, ST_linefromtext(concat('linestring', '$linestr')));
ALTER TABLE t1 ROW_FORMAT = DYNAMIC, KEY_BLOCK_SIZE=0, ALGORITHM=INPLACE; ALTER TABLE t1 ROW_FORMAT = DYNAMIC, KEY_BLOCK_SIZE=0, ALGORITHM=INPLACE;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
DROP TABLE t1; DROP TABLE t1;

View File

@ -5,6 +5,10 @@
# bzip2 # bzip2
set global innodb_compression_algorithm = 5; set global innodb_compression_algorithm = 5;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8;
show warnings; show warnings;
create table innodb_normal (c1 int, b char(20)) engine=innodb; create table innodb_normal (c1 int, b char(20)) engine=innodb;

View File

@ -5,6 +5,10 @@
# lz4 # lz4
set global innodb_compression_algorithm = 2; set global innodb_compression_algorithm = 2;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8;
show warnings; show warnings;
create table innodb_normal (c1 int, b char(20)) engine=innodb; create table innodb_normal (c1 int, b char(20)) engine=innodb;

View File

@ -5,6 +5,10 @@
# lzma # lzma
set global innodb_compression_algorithm = 4; set global innodb_compression_algorithm = 4;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8;
show warnings; show warnings;
create table innodb_normal (c1 int, b char(20)) engine=innodb; create table innodb_normal (c1 int, b char(20)) engine=innodb;

View File

@ -5,6 +5,10 @@
# lzo # lzo
set global innodb_compression_algorithm = 3; set global innodb_compression_algorithm = 3;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8;
show warnings; show warnings;
create table innodb_normal (c1 int, b char(20)) engine=innodb; create table innodb_normal (c1 int, b char(20)) engine=innodb;

View File

@ -6,6 +6,10 @@
# zlib # zlib
set global innodb_compression_algorithm = 1; set global innodb_compression_algorithm = 1;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8; create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8;
show warnings; show warnings;
create table innodb_normal (c1 int, b char(20)) engine=innodb; create table innodb_normal (c1 int, b char(20)) engine=innodb;

View File

@ -552,7 +552,10 @@ ib_unlink_tablespace("test", "t1");
EOF EOF
DROP TABLE t1; 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
CREATE TABLE t1( CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
@ -1071,6 +1074,9 @@ SHOW CREATE TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
call mtr.add_suppression("Got error -1 when reading table '.*'"); call mtr.add_suppression("Got error -1 when reading table '.*'");
call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'"); call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'");

View File

@ -1,32 +0,0 @@
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
create table t1(a blob) engine=innodb key_block_size=8;
delimiter //;
create function generate_blob()
returns varchar(20000)
begin
declare x varchar(20000) default '';
declare i int default 500;
while i > 0 do
set x = concat(sha1(i), x);
set i = i - 1;
end while;
return x;
end //
delimiter ;//
insert into t1 select generate_blob();
let $x = `select 20000 - length(a) from t1`;
if ($x) {
echo Blob is truncated by $x bytes.;
die It must have been 20000 bytes.;
}
truncate t1;
insert into t1 select generate_blob();
let $x = `select 20000 - length(a) from t1`;
if ($x) {
echo Blob is truncated by $x bytes.;
die It must have been 20000 bytes.;
}
drop table t1;
drop function generate_blob;

View File

@ -33,6 +33,10 @@ set global innodb_buffer_pool_size = 10485760;
select @@innodb_buffer_pool_size; select @@innodb_buffer_pool_size;
# fill buffer pool # fill buffer pool
--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 table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
create or replace view view0 as select 1 union all select 1; create or replace view view0 as select 1 union all select 1;
@ -41,6 +45,9 @@ set @`v_val` := 0;
# 2^18 == 262144 records # 2^18 == 262144 records
replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17; replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
# Shrink buffer pool # Shrink buffer pool
set global innodb_buffer_pool_size = 7340032; set global innodb_buffer_pool_size = 7340032;

View File

@ -24,6 +24,10 @@ if (`select (version() like '%debug%') > 0`)
select @@innodb_buffer_pool_chunk_size; select @@innodb_buffer_pool_chunk_size;
# fill buffer pool # fill buffer pool
--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 table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
create or replace view view0 as select 1 union all select 1; create or replace view view0 as select 1 union all select 1;
@ -32,6 +36,9 @@ set @`v_val` := 0;
# 2^18 == 262144 records # 2^18 == 262144 records
replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17; replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
# Shrink buffer pool to 7MB # Shrink buffer pool to 7MB
set global innodb_buffer_pool_size = 7340032; set global innodb_buffer_pool_size = 7340032;

View File

@ -2,3 +2,4 @@
--innodb_buffer_pool_size=32M --innodb_buffer_pool_size=32M
--skip-innodb-stats-persistent --skip-innodb-stats-persistent
--innodb-sys-tablestats --innodb-sys-tablestats
--skip-innodb-read-only-compressed

View File

@ -2,3 +2,4 @@
--innodb_buffer_pool_size=32M --innodb_buffer_pool_size=32M
--skip-innodb-stats-persistent --skip-innodb-stats-persistent
--innodb-sys-tablestats --innodb-sys-tablestats
--skip-innodb-read-only-compressed

View File

@ -1,2 +1,3 @@
--innodb-file-per-table --innodb-file-per-table
--skip-innodb-doublewrite --skip-innodb-doublewrite
--skip-innodb-read-only-compressed

View File

@ -1,2 +1,2 @@
--innodb-file-per-table --innodb-file-per-table
--skip-innodb-read-only-compressed

View File

@ -210,7 +210,10 @@ SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo # End of 10.3 tests --echo # End of 10.3 tests
--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 table t ( create table t (
a varchar(9), a varchar(9),
b int, b int,
@ -225,6 +228,9 @@ alter table t modify a varchar(10), algorithm=instant;
alter table t change b bb int, algorithm=instant; alter table t change b bb int, algorithm=instant;
alter table t modify c int without system versioning, algorithm=instant; alter table t modify c int without system versioning, algorithm=instant;
set @@system_versioning_alter_history = error; set @@system_versioning_alter_history = error;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
check table t; check table t;
drop table t; drop table t;

View File

@ -1,8 +1,18 @@
--source include/have_innodb.inc --source include/have_innodb.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
create table t (a int NOT NULL) engine=innodb row_format= compressed; create table t (a int NOT NULL) engine=innodb row_format= compressed;
--error ER_ALTER_OPERATION_NOT_SUPPORTED --error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t modify a int NULL, algorithm=instant; alter table t modify a int NULL, algorithm=instant;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
drop table t; drop table t;
create table t (a int NOT NULL) engine=innodb row_format= dynamic; create table t (a int NOT NULL) engine=innodb row_format= dynamic;

View File

@ -6,6 +6,9 @@
--echo # Bug#25330449 ASSERT SIZE==SPACE->SIZE DURING BUF_READ_AHEAD_RANDOM --echo # Bug#25330449 ASSERT SIZE==SPACE->SIZE DURING BUF_READ_AHEAD_RANDOM
let $MYSQLD_DATADIR=`SELECT @@datadir`; let $MYSQLD_DATADIR=`SELECT @@datadir`;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=INNODB ROW_FORMAT=COMPRESSED; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=INNODB ROW_FORMAT=COMPRESSED;
--source include/shutdown_mysqld.inc --source include/shutdown_mysqld.inc

View File

@ -1 +1,2 @@
--innodb-checksum-algorithm=crc32 --innodb-checksum-algorithm=crc32
--skip-innodb-read-only-compressed

View File

@ -23,7 +23,7 @@ create temporary table t2
--source suite/innodb/include/dml_ops.inc --source suite/innodb/include/dml_ops.inc
drop temporary table t1,t2; drop temporary table t1,t2;
# #
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
create temporary table t1 create temporary table t1
(keyc int, c1 char(100), c2 char(100), (keyc int, c1 char(100), c2 char(100),
primary key(keyc), index sec_index(c1) primary key(keyc), index sec_index(c1)

View File

@ -181,12 +181,12 @@ eval $check_no_innodb;
--let $restart_parameters= --let $restart_parameters=
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
create temporary table t ( create temporary table t (
i int) i int)
engine = innodb row_format = compressed; engine = innodb row_format = compressed;
# #
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
create temporary table t ( create temporary table t (
i int) i int)
engine = innodb row_format = compressed key_block_size = 8; engine = innodb row_format = compressed key_block_size = 8;
@ -211,7 +211,7 @@ show warnings;
set innodb_strict_mode = default; set innodb_strict_mode = default;
# #
drop table t; drop table t;
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
create temporary table t ( create temporary table t (
i int) i int)
engine = innodb row_format = compressed; engine = innodb row_format = compressed;
@ -344,7 +344,7 @@ DROP TABLE t1;
# Set innodb_strict_mode=ON and test compressed temporary tables again. # Set innodb_strict_mode=ON and test compressed temporary tables again.
set innodb_strict_mode = ON; set innodb_strict_mode = ON;
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
CREATE TEMPORARY TABLE t1 ( CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
c CHAR(10) NOT NULL c CHAR(10) NOT NULL
@ -352,7 +352,7 @@ CREATE TEMPORARY TABLE t1 (
SHOW WARNINGS; SHOW WARNINGS;
# #
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
CREATE TEMPORARY TABLE t1 ( CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
c CHAR(10) NOT NULL c CHAR(10) NOT NULL
@ -369,7 +369,7 @@ SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
# #
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
CREATE TEMPORARY TABLE t1 ( CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
c CHAR(10) NOT NULL c CHAR(10) NOT NULL
@ -377,7 +377,7 @@ CREATE TEMPORARY TABLE t1 (
SHOW WARNINGS; SHOW WARNINGS;
# #
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
CREATE TEMPORARY TABLE t1 ( CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
c CHAR(10) NOT NULL c CHAR(10) NOT NULL
@ -385,7 +385,7 @@ CREATE TEMPORARY TABLE t1 (
SHOW WARNINGS; SHOW WARNINGS;
# #
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
CREATE TEMPORARY TABLE t1 ( CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
c CHAR(10) NOT NULL c CHAR(10) NOT NULL
@ -393,7 +393,7 @@ CREATE TEMPORARY TABLE t1 (
SHOW WARNINGS; SHOW WARNINGS;
# #
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
CREATE TEMPORARY TABLE t1 ( CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY, i INT NOT NULL PRIMARY KEY,
c CHAR(10) NOT NULL c CHAR(10) NOT NULL
@ -414,15 +414,15 @@ CREATE TEMPORARY TABLE t1 (
i INT NOT NULL PRIMARY KEY i INT NOT NULL PRIMARY KEY
) ENGINE = InnoDB ROW_FORMAT = REDUNDANT; ) ENGINE = InnoDB ROW_FORMAT = REDUNDANT;
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
ALTER TABLE t1 ROW_FORMAT = COMPRESSED; ALTER TABLE t1 ROW_FORMAT = COMPRESSED;
SHOW WARNINGS; SHOW WARNINGS;
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
ALTER TABLE t1 KEY_BLOCK_SIZE = 4; ALTER TABLE t1 KEY_BLOCK_SIZE = 4;
SHOW WARNINGS; SHOW WARNINGS;
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4; ALTER TABLE t1 ROW_FORMAT = DYNAMIC KEY_BLOCK_SIZE = 4;
SHOW WARNINGS; SHOW WARNINGS;
@ -450,7 +450,7 @@ SHOW WARNINGS;
set innodb_strict_mode = ON; set innodb_strict_mode = ON;
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE --error ER_UNSUPPORTED_COMPRESSED_TABLE
ALTER TABLE t1 ADD COLUMN j INT; ALTER TABLE t1 ADD COLUMN j INT;
SHOW WARNINGS; SHOW WARNINGS;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;

View File

@ -19,10 +19,17 @@ DROP TABLE t;
--echo # --echo #
--echo # MDEV-17831 TRUNCATE TABLE removes ROW_FORMAT=COMPRESSED --echo # MDEV-17831 TRUNCATE TABLE removes ROW_FORMAT=COMPRESSED
--echo # --echo #
--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 TABLE t1 (a SERIAL) ENGINE=InnoDB KEY_BLOCK_SIZE=4; CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB KEY_BLOCK_SIZE=4;
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
--replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 # --replace_column 3 # 5 # 6 # 7 # 8 # 9 # 10 # 12 # 13 #
SHOW TABLE STATUS; SHOW TABLE STATUS;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #

View File

@ -1335,9 +1335,16 @@ SELECT * FROM t1 WHERE MATCH (a) AGAINST ('+"good database"' IN BOOLEAN MODE);
DROP TABLE t1; DROP TABLE t1;
# MDEV-19974 InnoDB: Cannot load compressed BLOB # MDEV-19974 InnoDB: Cannot load compressed BLOB
--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 TABLE t1(f1 TEXT, FULLTEXT KEY(f1))ENGINE=InnoDB; CREATE TABLE t1(f1 TEXT, FULLTEXT KEY(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES(repeat("this is the test case", 500)); INSERT INTO t1 VALUES(repeat("this is the test case", 500));
ALTER TABLE t1 KEY_BLOCK_SIZE=4; ALTER TABLE t1 KEY_BLOCK_SIZE=4;
ALTER TABLE t1 KEY_BLOCK_SIZE=0; ALTER TABLE t1 KEY_BLOCK_SIZE=0;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
DROP TABLE t1; DROP TABLE t1;

View File

@ -432,6 +432,10 @@ let $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
set global innodb_file_per_table=1; set global innodb_file_per_table=1;
--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 FTS table # Create FTS table
CREATE TABLE t1 ( CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
@ -579,6 +583,9 @@ SELECT * FROM t1 WHERE MATCH (a,b)
SELECT * FROM t1 ORDER BY id; SELECT * FROM t1 ORDER BY id;
DROP TABLE t1; DROP TABLE t1;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig; eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -15,6 +15,10 @@
--source include/have_innodb_16k.inc --source include/have_innodb_16k.inc
--source include/have_geometry.inc --source include/have_geometry.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
# Check spatial index functionality on compress table with Primary key # Check spatial index functionality on compress table with Primary key
CREATE TABLE tab(c1 int NOT NULL PRIMARY KEY,c2 POINT NOT NULL, CREATE TABLE tab(c1 int NOT NULL PRIMARY KEY,c2 POINT NOT NULL,
@ -1107,6 +1111,9 @@ SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))');
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1;
DELETE FROM tab WHERE MBRIntersects(tab.c4, @g1); DELETE FROM tab WHERE MBRIntersects(tab.c4, @g1);
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1;

View File

@ -8,11 +8,8 @@ insert into worklog5743 values(repeat("a", 20000));
update worklog5743 set a = (repeat("b", 16000)); update worklog5743 set a = (repeat("b", 16000));
SET sql_mode= ''; SET sql_mode= '';
create index idx on worklog5743(a(900)); create index idx on worklog5743(a(900));
Warnings:
Note 1071 Specified key was too long; max key length is 768 bytes
show warnings; show warnings;
Level Code Message Level Code Message
Note 1071 Specified key was too long; max key length is 768 bytes
SET sql_mode= default; SET sql_mode= default;
begin; begin;
update worklog5743 set a = (repeat("x", 17000)); update worklog5743 set a = (repeat("x", 17000));
@ -101,7 +98,7 @@ create index idx1 on worklog5743_1(a2(4000));
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
show warnings; show warnings;
Level Code Message Level Code Message
Note 1071 Specified key was too long; max key length is 768 bytes Note 1071 Specified key was too long; max key length is 1173 bytes
Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs Error 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
create index idx3 on worklog5743_1(a2(436)); create index idx3 on worklog5743_1(a2(436));
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
@ -121,68 +118,41 @@ show warnings;
Level Code Message Level Code Message
SET sql_mode= ''; SET sql_mode= '';
create index idx1 on worklog5743_2(a2(4000)); create index idx1 on worklog5743_2(a2(4000));
Warnings: ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1982. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
Note 1071 Specified key was too long; max key length is 768 bytes
show warnings;
Level Code Message
Note 1071 Specified key was too long; max key length is 768 bytes
show create table worklog5743_2;
Table Create Table
worklog5743_2 CREATE TABLE `worklog5743_2` (
`a1` int(11) DEFAULT NULL,
`a2` text NOT NULL,
KEY `idx1` (`a2`(768))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2
create index idx3 on worklog5743_2(a2(769)); create index idx3 on worklog5743_2(a2(769));
Warnings:
Note 1071 Specified key was too long; max key length is 768 bytes
show warnings; show warnings;
Level Code Message Level Code Message
Note 1071 Specified key was too long; max key length is 768 bytes
create index idx4 on worklog5743_2(a2(768)); create index idx4 on worklog5743_2(a2(768));
Warnings:
Note 1831 Duplicate index `idx4`. This is deprecated and will be disallowed in a future release
show warnings; show warnings;
Level Code Message Level Code Message
Note 1831 Duplicate index `idx4`. This is deprecated and will be disallowed in a future release
create index idx5 on worklog5743_2(a1, a2(765)); create index idx5 on worklog5743_2(a1, a2(765));
ERROR 42000: Specified key was too long; max key length is 768 bytes
show warnings; show warnings;
Level Code Message Level Code Message
Error 1071 Specified key was too long; max key length is 768 bytes
create index idx6 on worklog5743_2(a1, a2(764)); create index idx6 on worklog5743_2(a1, a2(764));
show warnings; show warnings;
Level Code Message Level Code Message
create index idx1 on worklog5743_4(a2(4000)); create index idx1 on worklog5743_4(a2(4000));
Warnings: Warnings:
Note 1071 Specified key was too long; max key length is 768 bytes Note 1071 Specified key was too long; max key length is 1173 bytes
show warnings; show warnings;
Level Code Message Level Code Message
Note 1071 Specified key was too long; max key length is 768 bytes Note 1071 Specified key was too long; max key length is 1173 bytes
show create table worklog5743_4; show create table worklog5743_4;
Table Create Table Table Create Table
worklog5743_4 CREATE TABLE `worklog5743_4` ( worklog5743_4 CREATE TABLE `worklog5743_4` (
`a1` int(11) DEFAULT NULL, `a1` int(11) DEFAULT NULL,
`a2` text NOT NULL, `a2` text NOT NULL,
KEY `idx1` (`a2`(768)) KEY `idx1` (`a2`(1173))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
create index idx3 on worklog5743_4(a2(769)); create index idx3 on worklog5743_4(a2(769));
Warnings:
Note 1071 Specified key was too long; max key length is 768 bytes
show warnings; show warnings;
Level Code Message Level Code Message
Note 1071 Specified key was too long; max key length is 768 bytes
create index idx4 on worklog5743_4(a2(768)); create index idx4 on worklog5743_4(a2(768));
Warnings:
Note 1831 Duplicate index `idx4`. This is deprecated and will be disallowed in a future release
show warnings; show warnings;
Level Code Message Level Code Message
Note 1831 Duplicate index `idx4`. This is deprecated and will be disallowed in a future release
create index idx5 on worklog5743_4(a1, a2(765)); create index idx5 on worklog5743_4(a1, a2(765));
ERROR 42000: Specified key was too long; max key length is 768 bytes
show warnings; show warnings;
Level Code Message Level Code Message
Error 1071 Specified key was too long; max key length is 768 bytes
create index idx6 on worklog5743_4(a1, a2(764)); create index idx6 on worklog5743_4(a1, a2(764));
show warnings; show warnings;
Level Code Message Level Code Message
@ -221,10 +191,10 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE worklog5743_1 ref idx6 idx6 5 const 1 1 SIMPLE worklog5743_1 ref idx6 idx6 5 const 1
explain select a1, left(a2, 20) from worklog5743_2 where a1 = 9; explain select a1, left(a2, 20) from worklog5743_2 where a1 = 9;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE worklog5743_2 ref idx6 idx6 5 const 1 1 SIMPLE worklog5743_2 ref idx5,idx6 idx5 5 const 1
explain select a1, left(a2, 20) from worklog5743_4 where a1 = 9; explain select a1, left(a2, 20) from worklog5743_4 where a1 = 9;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE worklog5743_4 ref idx6 idx6 5 const 1 1 SIMPLE worklog5743_4 ref idx5,idx6 idx5 5 const 1
select a1, left(a2, 20) from worklog5743_1 where a1 = 9; select a1, left(a2, 20) from worklog5743_1 where a1 = 9;
a1 left(a2, 20) a1 left(a2, 20)
9 aaaaaaaaaaaaaaaaaaaa 9 aaaaaaaaaaaaaaaaaaaa
@ -253,25 +223,23 @@ drop table worklog5743_4;
### Test 5 ### ### Test 5 ###
create table worklog5743(a1 int, a2 varchar(20000)) ROW_FORMAT=DYNAMIC; create table worklog5743(a1 int, a2 varchar(20000)) ROW_FORMAT=DYNAMIC;
create index idx1 on worklog5743(a2); create index idx1 on worklog5743(a2);
ERROR 42000: Specified key was too long; max key length is 3072 bytes ERROR 42000: Specified key was too long; max key length is 1173 bytes
show warnings; show warnings;
Level Code Message Level Code Message
Error 1071 Specified key was too long; max key length is 3072 bytes Warning 1071 Specified key was too long; max key length is 3072 bytes
Error 1071 Specified key was too long; max key length is 768 bytes Error 1071 Specified key was too long; max key length is 1173 bytes
drop table worklog5743; drop table worklog5743;
create table worklog5743(a1 int, a2 varchar(3072)) ROW_FORMAT=DYNAMIC; create table worklog5743(a1 int, a2 varchar(3072)) ROW_FORMAT=DYNAMIC;
create index idx1 on worklog5743(a2); create index idx1 on worklog5743(a2);
ERROR 42000: Specified key was too long; max key length is 768 bytes ERROR 42000: Specified key was too long; max key length is 1173 bytes
show warnings; show warnings;
Level Code Message Level Code Message
Error 1071 Specified key was too long; max key length is 768 bytes Error 1071 Specified key was too long; max key length is 1173 bytes
drop table worklog5743; drop table worklog5743;
create table worklog5743(a1 int, a2 varchar(769)) ROW_FORMAT=DYNAMIC; create table worklog5743(a1 int, a2 varchar(769)) ROW_FORMAT=DYNAMIC;
create index idx1 on worklog5743(a2); create index idx1 on worklog5743(a2);
ERROR 42000: Specified key was too long; max key length is 768 bytes
show warnings; show warnings;
Level Code Message Level Code Message
Error 1071 Specified key was too long; max key length is 768 bytes
drop table worklog5743; drop table worklog5743;
create table worklog5743(a1 int, a2 varchar(768)) ROW_FORMAT=DYNAMIC; create table worklog5743(a1 int, a2 varchar(768)) ROW_FORMAT=DYNAMIC;
create index idx1 on worklog5743(a2); create index idx1 on worklog5743(a2);
@ -282,10 +250,8 @@ update worklog5743 set a1 = 3333;
drop table worklog5743; drop table worklog5743;
create table worklog5743(a1 int, a2 varchar(765)) ROW_FORMAT=DYNAMIC; create table worklog5743(a1 int, a2 varchar(765)) ROW_FORMAT=DYNAMIC;
create index idx1 on worklog5743(a1, a2); create index idx1 on worklog5743(a1, a2);
ERROR 42000: Specified key was too long; max key length is 768 bytes
show warnings; show warnings;
Level Code Message Level Code Message
Error 1071 Specified key was too long; max key length is 768 bytes
drop table worklog5743; drop table worklog5743;
create table worklog5743(a1 int, a2 varchar(764)) ROW_FORMAT=DYNAMIC; create table worklog5743(a1 int, a2 varchar(764)) ROW_FORMAT=DYNAMIC;
create index idx1 on worklog5743(a1, a2); create index idx1 on worklog5743(a1, a2);
@ -315,8 +281,6 @@ connection default;
rollback; rollback;
drop table worklog5743; drop table worklog5743;
### Test 6 ### ### Test 6 ###
create table worklog5743(a TEXT not null, primary key (a(1000)));
ERROR 42000: Specified key was too long; max key length is 768 bytes
create table worklog5743(a TEXT) ROW_FORMAT=COMPACT; create table worklog5743(a TEXT) ROW_FORMAT=COMPACT;
create index idx on worklog5743(a(768)); create index idx on worklog5743(a(768));
ERROR HY000: Index column size too large. The maximum column size is 767 bytes ERROR HY000: Index column size too large. The maximum column size is 767 bytes
@ -350,23 +314,17 @@ drop table worklog5743;
create table worklog5743(a TEXT not null) ROW_FORMAT=DYNAMIC; create table worklog5743(a TEXT not null) ROW_FORMAT=DYNAMIC;
SET sql_mode= ''; SET sql_mode= '';
create index idx1 on worklog5743(a(769)); create index idx1 on worklog5743(a(769));
Warnings:
Note 1071 Specified key was too long; max key length is 768 bytes
show warnings; show warnings;
Level Code Message Level Code Message
Note 1071 Specified key was too long; max key length is 768 bytes
SET sql_mode= default; SET sql_mode= default;
create index idx2 on worklog5743(a(768)); create index idx2 on worklog5743(a(768));
Warnings:
Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release
show warnings; show warnings;
Level Code Message Level Code Message
Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release
show create table worklog5743; show create table worklog5743;
Table Create Table Table Create Table
worklog5743 CREATE TABLE `worklog5743` ( worklog5743 CREATE TABLE `worklog5743` (
`a` text NOT NULL, `a` text NOT NULL,
KEY `idx1` (`a`(768)), KEY `idx1` (`a`(769)),
KEY `idx2` (`a`(768)) KEY `idx2` (`a`(768))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
insert into worklog5743 values(repeat("a", 768)); insert into worklog5743 values(repeat("a", 768));

View File

@ -266,7 +266,7 @@ drop table worklog5743_8;
### Test 5 ### ### Test 5 ###
create table worklog5743(a1 int, a2 varchar(20000)) ROW_FORMAT=DYNAMIC; create table worklog5743(a1 int, a2 varchar(20000)) ROW_FORMAT=DYNAMIC;
create index idx1 on worklog5743(a2); create index idx1 on worklog5743(a2);
ERROR 42000: Specified key was too long; max key length is 3072 bytes ERROR 42000: Specified key was too long; max key length is 1536 bytes
drop table worklog5743; drop table worklog5743;
create table worklog5743(a1 int, a2 varchar(1537)) ROW_FORMAT=DYNAMIC; create table worklog5743(a1 int, a2 varchar(1537)) ROW_FORMAT=DYNAMIC;
create index idx1 on worklog5743(a2); create index idx1 on worklog5743(a2);

View File

@ -24,6 +24,10 @@ SELECT * FROM information_schema.innodb_cmp_per_index_reset;
# see that the table is empty # see that the table is empty
SELECT * FROM information_schema.innodb_cmp_per_index; 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 a table that uses compression
CREATE TABLE t ( CREATE TABLE t (
a INT, a INT,
@ -57,6 +61,9 @@ while ($i)
COMMIT; COMMIT;
ALTER TABLE t DROP INDEX c; 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'; GRANT USAGE ON *.* TO 'tuser01'@'localhost' IDENTIFIED BY 'cDJvI9s_Uq';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;

View File

@ -6,6 +6,8 @@ SET default_storage_engine=InnoDB;
--disable_query_log --disable_query_log
call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is"); 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 --enable_query_log
let $innodb_file_per_table_orig=`select @@innodb_file_per_table`; 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 -- error ER_INDEX_COLUMN_TOO_LONG
create index idx on worklog5743(a(768)); create index idx on worklog5743(a(768));
create index idx2 on worklog5743(a(767)); 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; drop table worklog5743;
eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig; eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;

View File

@ -6,6 +6,8 @@ SET default_storage_engine=InnoDB;
--disable_query_log --disable_query_log
call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is"); 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 --enable_query_log
let $innodb_file_per_table_orig=`select @@innodb_file_per_table`; 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 # Test edge cases for indexes using key_block_size=2
SET sql_mode= ''; SET sql_mode= '';
--error ER_TOO_BIG_ROWSIZE
create index idx1 on worklog5743_2(a2(4000)); create index idx1 on worklog5743_2(a2(4000));
show warnings;
show create table worklog5743_2;
create index idx3 on worklog5743_2(a2(769)); create index idx3 on worklog5743_2(a2(769));
show warnings; show warnings;
create index idx4 on worklog5743_2(a2(768)); create index idx4 on worklog5743_2(a2(768));
show warnings; show warnings;
-- error ER_TOO_LONG_KEY
create index idx5 on worklog5743_2(a1, a2(765)); create index idx5 on worklog5743_2(a1, a2(765));
show warnings; show warnings;
create index idx6 on worklog5743_2(a1, a2(764)); create index idx6 on worklog5743_2(a1, a2(764));
@ -174,7 +174,6 @@ create index idx3 on worklog5743_4(a2(769));
show warnings; show warnings;
create index idx4 on worklog5743_4(a2(768)); create index idx4 on worklog5743_4(a2(768));
show warnings; show warnings;
-- error ER_TOO_LONG_KEY
create index idx5 on worklog5743_4(a1, a2(765)); create index idx5 on worklog5743_4(a1, a2(765));
show warnings; show warnings;
create index idx6 on worklog5743_4(a1, a2(764)); create index idx6 on worklog5743_4(a1, a2(764));
@ -272,7 +271,6 @@ show warnings;
drop table worklog5743; drop table worklog5743;
create table worklog5743(a1 int, a2 varchar(769)) ROW_FORMAT=DYNAMIC; create table worklog5743(a1 int, a2 varchar(769)) ROW_FORMAT=DYNAMIC;
-- error ER_TOO_LONG_KEY
create index idx1 on worklog5743(a2); create index idx1 on worklog5743(a2);
show warnings; show warnings;
drop table worklog5743; drop table worklog5743;
@ -285,7 +283,6 @@ update worklog5743 set a1 = 3333;
drop table worklog5743; drop table worklog5743;
create table worklog5743(a1 int, a2 varchar(765)) ROW_FORMAT=DYNAMIC; create table worklog5743(a1 int, a2 varchar(765)) ROW_FORMAT=DYNAMIC;
-- error ER_TOO_LONG_KEY
create index idx1 on worklog5743(a1, a2); create index idx1 on worklog5743(a1, a2);
show warnings; show warnings;
drop table worklog5743; drop table worklog5743;
@ -316,10 +313,6 @@ rollback;
drop table worklog5743; drop table worklog5743;
-- echo ### Test 6 ### -- 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; create table worklog5743(a TEXT) ROW_FORMAT=COMPACT;
# Excercise the column length check in ha_innobase::add_index() # 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 -- error ER_INDEX_COLUMN_TOO_LONG
create index idx on worklog5743(a(768)); create index idx on worklog5743(a(768));
create index idx2 on worklog5743(a(767)); 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; drop table worklog5743;
eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig; eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;

View File

@ -6,6 +6,8 @@ SET default_storage_engine=InnoDB;
--disable_query_log --disable_query_log
call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is"); 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 --enable_query_log
let $innodb_file_per_table_orig=`select @@innodb_file_per_table`; 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 -- error ER_INDEX_COLUMN_TOO_LONG
create index idx on worklog5743(a(768)); create index idx on worklog5743(a(768));
create index idx2 on worklog5743(a(767)); 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; drop table worklog5743;
eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig; eval SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;

View File

@ -81,6 +81,10 @@ INSERT INTO t1 VALUES (1, '');
UPDATE t1 SET c2=@longblob; UPDATE t1 SET c2=@longblob;
DROP TABLE t1; 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 #
--echo # Separate tablespace, Row Format = Compressed, Key Block Size = 2k --echo # Separate tablespace, Row Format = Compressed, Key Block Size = 2k
--echo # --echo #
@ -103,6 +107,9 @@ CREATE TABLE t1 (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1; ) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=1;
INSERT INTO t1 VALUES (1, ''); INSERT INTO t1 VALUES (1, '');
UPDATE t1 SET c2=@longblob; 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; DROP TABLE t1;
--echo # --echo #

View File

@ -15,6 +15,11 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_innodb_16k.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'); 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 # Prefix index with VARCHAR data type , primary/secondary index and DML ops
CREATE TABLE worklog5743 ( CREATE TABLE worklog5743 (
@ -1325,4 +1330,7 @@ ALTER TABLE worklog5743 ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE;
ALTER TABLE worklog5743 ROW_FORMAT=REDUNDANT, ALGORITHM=COPY; ALTER TABLE worklog5743 ROW_FORMAT=REDUNDANT, ALGORITHM=COPY;
--disable_info --disable_info
SHOW CREATE TABLE worklog5743; SHOW CREATE TABLE worklog5743;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log
DROP TABLE worklog5743; DROP TABLE worklog5743;

View File

@ -23,6 +23,9 @@ let $innodb_compression_level = `SELECT @@global.innodb_compression_level`;
SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_file_per_table=on;
SET GLOBAL innodb_cmp_per_index_enabled=ON; SET GLOBAL innodb_cmp_per_index_enabled=ON;
SET GLOBAL innodb_compression_level=0; SET GLOBAL innodb_compression_level=0;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
--echo #****************************************************************** --echo #******************************************************************
--echo # Test 1-1K: innodb_cmp_per_index_enabled=ON and innodb_compression_level=0 with page size 1K --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) --echo # set the flag on (default off)
SET GLOBAL innodb_cmp_per_index_enabled=ON; 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 --echo # set the flags
SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_file_per_table=on;
@ -151,6 +157,9 @@ DROP TABLE tab5;
--echo # reset the stat table before starting next testcase --echo # reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=0; SET GLOBAL innodb_cmp_per_index_enabled=0;
SET GLOBAL innodb_cmp_per_index_enabled=1; 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 a table with page size=4K
--echo # create indexes on each column.(total 9 indexes) --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 --echo # reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF; SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON; 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 a table with page size=2K
--echo # create indexes on each column.(total 9 indexes) --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 --echo # reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF; SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON; 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 a table with page size=4K
--echo # create indexes on each column.(total 9 indexes) --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 --echo # reset the stat table before starting next testcase
SET GLOBAL innodb_cmp_per_index_enabled=OFF; SET GLOBAL innodb_cmp_per_index_enabled=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON; 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 a table with page size=2K
--echo # create indexes on each column.(total 9 indexes) --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=OFF;
SET GLOBAL innodb_cmp_per_index_enabled=ON; SET GLOBAL innodb_cmp_per_index_enabled=ON;
SET GLOBAL innodb_compression_failure_threshold_pct=10; 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 a table with page size=2K
--echo # create indexes on each column.(total 9 indexes) --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; eval SET GLOBAL innodb_cmp_per_index_enabled=default;
--disable_query_log --disable_query_log
eval SET GLOBAL innodb_compression_level=$innodb_compression_level; eval SET GLOBAL innodb_compression_level=$innodb_compression_level;
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log --enable_query_log
eval SET GLOBAL innodb_compression_failure_threshold_pct=default; eval SET GLOBAL innodb_compression_failure_threshold_pct=default;

View File

@ -1,4 +1,11 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_partition.inc --source include/have_partition.inc
--let $engine=InnoDB --let $engine=InnoDB
--disable_query_log
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
--source inc/part_alter_values.inc --source inc/part_alter_values.inc
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
--enable_query_log

View File

@ -1,9 +1,15 @@
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
SELECT @@global.innodb_buffer_pool_evict; SELECT @@global.innodb_buffer_pool_evict;
@@global.innodb_buffer_pool_evict @@global.innodb_buffer_pool_evict
SET GLOBAL innodb_read_only_compressed=ON;
CREATE TABLE t(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
ERROR HY000: InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SET GLOBAL innodb_read_only_compressed=OFF;
CREATE TABLE t(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; CREATE TABLE t(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
SET GLOBAL innodb_buffer_pool_evict = 'uncompressed'; SET GLOBAL innodb_buffer_pool_evict = 'uncompressed';
SELECT @@global.innodb_buffer_pool_evict; SELECT @@global.innodb_buffer_pool_evict;
@@global.innodb_buffer_pool_evict @@global.innodb_buffer_pool_evict
DROP TABLE t; DROP TABLE t;
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;

View File

@ -1,3 +1,5 @@
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
SET GLOBAL innodb_read_only_compressed=OFF;
SELECT @@global.innodb_cmp_per_index_enabled; SELECT @@global.innodb_cmp_per_index_enabled;
@@global.innodb_cmp_per_index_enabled @@global.innodb_cmp_per_index_enabled
0 0
@ -61,3 +63,4 @@ uncompress_ops 0
uncompress_time 0 uncompress_time 0
DROP TABLE t; DROP TABLE t;
SET GLOBAL innodb_cmp_per_index_enabled=default; SET GLOBAL innodb_cmp_per_index_enabled=default;
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;

View File

@ -1449,6 +1449,18 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON ENUM_VALUE_LIST OFF,ON
READ_ONLY YES READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_READ_ONLY_COMPRESSED
SESSION_VALUE NULL
DEFAULT_VALUE ON
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Make ROW_FORMAT=COMPRESSED tables read-only (ON by default)
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME INNODB_ROLLBACK_ON_TIMEOUT VARIABLE_NAME INNODB_ROLLBACK_ON_TIMEOUT
SESSION_VALUE NULL SESSION_VALUE NULL
DEFAULT_VALUE OFF DEFAULT_VALUE OFF

View File

@ -2,11 +2,18 @@
# This is a debug variable for now # This is a debug variable for now
-- source include/have_debug.inc -- source include/have_debug.inc
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
SELECT @@global.innodb_buffer_pool_evict; SELECT @@global.innodb_buffer_pool_evict;
SET GLOBAL innodb_read_only_compressed=ON;
--error ER_UNSUPPORTED_COMPRESSED_TABLE
CREATE TABLE t(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
SET GLOBAL innodb_read_only_compressed=OFF;
CREATE TABLE t(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; CREATE TABLE t(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
SET GLOBAL innodb_buffer_pool_evict = 'uncompressed'; SET GLOBAL innodb_buffer_pool_evict = 'uncompressed';
# Should always be empty. # Should always be empty.
SELECT @@global.innodb_buffer_pool_evict; SELECT @@global.innodb_buffer_pool_evict;
DROP TABLE t; DROP TABLE t;
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;

View File

@ -2,6 +2,9 @@
# CREATE TABLE ... KEY_BLOCK_SIZE=8; does not work with page size = 4k # CREATE TABLE ... KEY_BLOCK_SIZE=8; does not work with page size = 4k
-- source include/have_innodb_16k.inc -- source include/have_innodb_16k.inc
SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed;
SET GLOBAL innodb_read_only_compressed=OFF;
# Check the default value # Check the default value
SELECT @@global.innodb_cmp_per_index_enabled; SELECT @@global.innodb_cmp_per_index_enabled;
@ -64,3 +67,4 @@ DROP TABLE t;
# #
SET GLOBAL innodb_cmp_per_index_enabled=default; SET GLOBAL innodb_cmp_per_index_enabled=default;
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;

View File

@ -7645,8 +7645,8 @@ ER_JSON_PATH_ARRAY
eng "JSON path should end with an array identifier in argument %d to function '%s'" eng "JSON path should end with an array identifier in argument %d to function '%s'"
ER_JSON_ONE_OR_ALL ER_JSON_ONE_OR_ALL
eng "Argument 2 to function '%s' must be "one" or "all"." eng "Argument 2 to function '%s' must be "one" or "all"."
ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE ER_UNSUPPORTED_COMPRESSED_TABLE
eng "CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE." eng "InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE."
ER_GEOJSON_INCORRECT ER_GEOJSON_INCORRECT
eng "Incorrect GeoJSON format specified for st_geomfromgeojson function." eng "Incorrect GeoJSON format specified for st_geomfromgeojson function."
ER_GEOJSON_TOO_FEW_POINTS ER_GEOJSON_TOO_FEW_POINTS

View File

@ -223,6 +223,9 @@ enum default_row_format_enum {
DEFAULT_ROW_FORMAT_DYNAMIC = 2, DEFAULT_ROW_FORMAT_DYNAMIC = 2,
}; };
/** Whether ROW_FORMAT=COMPRESSED tables are read-only */
static my_bool innodb_read_only_compressed;
/** A dummy variable */ /** A dummy variable */
static uint innodb_max_purge_lag_wait; static uint innodb_max_purge_lag_wait;
@ -7236,6 +7239,25 @@ ha_innobase::innobase_set_max_autoinc(
return(error); return(error);
} }
/** @return whether the table is read-only */
bool ha_innobase::is_read_only() const
{
ut_ad(m_prebuilt->trx == thd_to_trx(m_user_thd));
if (high_level_read_only)
{
ib_senderrf(m_user_thd, IB_LOG_LEVEL_WARN, ER_READ_ONLY_MODE);
return true;
}
if (!DICT_TF_GET_ZIP_SSIZE(m_prebuilt->table->flags) ||
!innodb_read_only_compressed)
return false;
ib_senderrf(m_user_thd, IB_LOG_LEVEL_WARN, ER_UNSUPPORTED_COMPRESSED_TABLE);
return true;
}
/********************************************************************//** /********************************************************************//**
Stores a row in an InnoDB database, to the table specified in this Stores a row in an InnoDB database, to the table specified in this
handle. handle.
@ -7258,13 +7280,10 @@ ha_innobase::write_row(
trx_t* trx = thd_to_trx(m_user_thd); trx_t* trx = thd_to_trx(m_user_thd);
/* Validation checks before we commence write_row operation. */ /* Validation checks before we commence write_row operation. */
if (high_level_read_only) { if (is_read_only()) {
ib_senderrf(ha_thd(), IB_LOG_LEVEL_WARN, ER_READ_ONLY_MODE);
DBUG_RETURN(HA_ERR_TABLE_READONLY); DBUG_RETURN(HA_ERR_TABLE_READONLY);
} }
ut_a(m_prebuilt->trx == trx);
if (!trx_is_started(trx)) { if (!trx_is_started(trx)) {
++trx->will_lock; ++trx->will_lock;
} }
@ -8038,10 +8057,7 @@ ha_innobase::update_row(
DBUG_ENTER("ha_innobase::update_row"); DBUG_ENTER("ha_innobase::update_row");
ut_a(m_prebuilt->trx == trx); if (is_read_only()) {
if (high_level_read_only) {
ib_senderrf(ha_thd(), IB_LOG_LEVEL_WARN, ER_READ_ONLY_MODE);
DBUG_RETURN(HA_ERR_TABLE_READONLY); DBUG_RETURN(HA_ERR_TABLE_READONLY);
} else if (!trx_is_started(trx)) { } else if (!trx_is_started(trx)) {
++trx->will_lock; ++trx->will_lock;
@ -8199,10 +8215,7 @@ ha_innobase::delete_row(
DBUG_ENTER("ha_innobase::delete_row"); DBUG_ENTER("ha_innobase::delete_row");
ut_a(m_prebuilt->trx == trx); if (is_read_only()) {
if (high_level_read_only) {
ib_senderrf(ha_thd(), IB_LOG_LEVEL_WARN, ER_READ_ONLY_MODE);
DBUG_RETURN(HA_ERR_TABLE_READONLY); DBUG_RETURN(HA_ERR_TABLE_READONLY);
} else if (!trx_is_started(trx)) { } else if (!trx_is_started(trx)) {
++trx->will_lock; ++trx->will_lock;
@ -10602,9 +10615,8 @@ create_table_info_t::create_options_are_invalid()
/* Check if a non-zero KEY_BLOCK_SIZE was specified. */ /* Check if a non-zero KEY_BLOCK_SIZE was specified. */
if (has_key_block_size) { if (has_key_block_size) {
if (is_temp) { if (is_temp || innodb_read_only_compressed) {
my_error(ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE, my_error(ER_UNSUPPORTED_COMPRESSED_TABLE, MYF(0));
MYF(0));
return("KEY_BLOCK_SIZE"); return("KEY_BLOCK_SIZE");
} }
@ -10659,9 +10671,8 @@ create_table_info_t::create_options_are_invalid()
other incompatibilities. */ other incompatibilities. */
switch (row_format) { switch (row_format) {
case ROW_TYPE_COMPRESSED: case ROW_TYPE_COMPRESSED:
if (is_temp) { if (is_temp || innodb_read_only_compressed) {
my_error(ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE, my_error(ER_UNSUPPORTED_COMPRESSED_TABLE, MYF(0));
MYF(0));
return("ROW_FORMAT"); return("ROW_FORMAT");
} }
if (!m_allow_file_per_table) { if (!m_allow_file_per_table) {
@ -12759,7 +12770,7 @@ ha_innobase::discard_or_import_tablespace(
ut_a(m_prebuilt->trx->magic_n == TRX_MAGIC_N); ut_a(m_prebuilt->trx->magic_n == TRX_MAGIC_N);
ut_a(m_prebuilt->trx == thd_to_trx(ha_thd())); ut_a(m_prebuilt->trx == thd_to_trx(ha_thd()));
if (high_level_read_only) { if (is_read_only()) {
DBUG_RETURN(HA_ERR_TABLE_READONLY); DBUG_RETURN(HA_ERR_TABLE_READONLY);
} }
@ -13281,12 +13292,12 @@ int ha_innobase::truncate()
{ {
DBUG_ENTER("ha_innobase::truncate"); DBUG_ENTER("ha_innobase::truncate");
if (high_level_read_only) { update_thd();
if (is_read_only()) {
DBUG_RETURN(HA_ERR_TABLE_READONLY); DBUG_RETURN(HA_ERR_TABLE_READONLY);
} }
update_thd();
HA_CREATE_INFO info; HA_CREATE_INFO info;
mem_heap_t* heap = mem_heap_create(1000); mem_heap_t* heap = mem_heap_create(1000);
dict_table_t* ib_table = m_prebuilt->table; dict_table_t* ib_table = m_prebuilt->table;
@ -19336,6 +19347,11 @@ static MYSQL_SYSVAR_BOOL(read_only, srv_read_only_mode,
"Start InnoDB in read only mode (off by default)", "Start InnoDB in read only mode (off by default)",
NULL, NULL, FALSE); NULL, NULL, FALSE);
static MYSQL_SYSVAR_BOOL(read_only_compressed, innodb_read_only_compressed,
PLUGIN_VAR_OPCMDARG,
"Make ROW_FORMAT=COMPRESSED tables read-only (ON by default)",
NULL, NULL, TRUE);
static MYSQL_SYSVAR_BOOL(cmp_per_index_enabled, srv_cmp_per_index_enabled, static MYSQL_SYSVAR_BOOL(cmp_per_index_enabled, srv_cmp_per_index_enabled,
PLUGIN_VAR_OPCMDARG, PLUGIN_VAR_OPCMDARG,
"Enable INFORMATION_SCHEMA.innodb_cmp_per_index," "Enable INFORMATION_SCHEMA.innodb_cmp_per_index,"
@ -19625,6 +19641,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(random_read_ahead), MYSQL_SYSVAR(random_read_ahead),
MYSQL_SYSVAR(read_ahead_threshold), MYSQL_SYSVAR(read_ahead_threshold),
MYSQL_SYSVAR(read_only), MYSQL_SYSVAR(read_only),
MYSQL_SYSVAR(read_only_compressed),
MYSQL_SYSVAR(instant_alter_column_allowed), MYSQL_SYSVAR(instant_alter_column_allowed),
MYSQL_SYSVAR(io_capacity), MYSQL_SYSVAR(io_capacity),
MYSQL_SYSVAR(io_capacity_max), MYSQL_SYSVAR(io_capacity_max),

View File

@ -460,6 +460,9 @@ protected:
@see build_template() */ @see build_template() */
void reset_template(); void reset_template();
/** @return whether the table is read-only */
bool is_read_only() const;
inline void update_thd(THD* thd); inline void update_thd(THD* thd);
void update_thd(); void update_thd();

View File

@ -1975,7 +1975,7 @@ ha_innobase::check_if_supported_inplace_alter(
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
} }
if (high_level_read_only) { if (is_read_only()) {
ha_alter_info->unsupported_reason = ha_alter_info->unsupported_reason =
my_get_err_msg(ER_READ_ONLY_MODE); my_get_err_msg(ER_READ_ONLY_MODE);