1
0
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:
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,11 +8,8 @@ insert into worklog5743 values(repeat("a", 20000));
update worklog5743 set a = (repeat("b", 16000));
SET sql_mode= '';
create index idx on worklog5743(a(900));
Warnings:
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
SET sql_mode= default;
begin;
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
show warnings;
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
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
@@ -121,68 +118,41 @@ show warnings;
Level Code Message
SET sql_mode= '';
create index idx1 on worklog5743_2(a2(4000));
Warnings:
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
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
create index idx3 on worklog5743_2(a2(769));
Warnings:
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
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;
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));
ERROR 42000: Specified key was too long; max key length is 768 bytes
show warnings;
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));
show warnings;
Level Code Message
create index idx1 on worklog5743_4(a2(4000));
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;
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;
Table Create Table
worklog5743_4 CREATE TABLE `worklog5743_4` (
`a1` int(11) DEFAULT NULL,
`a2` text NOT NULL,
KEY `idx1` (`a2`(768))
KEY `idx1` (`a2`(1173))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=4
create index idx3 on worklog5743_4(a2(769));
Warnings:
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
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;
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));
ERROR 42000: Specified key was too long; max key length is 768 bytes
show warnings;
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));
show warnings;
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
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
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;
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;
a1 left(a2, 20)
9 aaaaaaaaaaaaaaaaaaaa
@@ -253,25 +223,23 @@ drop table worklog5743_4;
### Test 5 ###
create table worklog5743(a1 int, a2 varchar(20000)) ROW_FORMAT=DYNAMIC;
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;
Level Code Message
Error 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
Warning 1071 Specified key was too long; max key length is 3072 bytes
Error 1071 Specified key was too long; max key length is 1173 bytes
drop table worklog5743;
create table worklog5743(a1 int, a2 varchar(3072)) ROW_FORMAT=DYNAMIC;
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;
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;
create table worklog5743(a1 int, a2 varchar(769)) ROW_FORMAT=DYNAMIC;
create index idx1 on worklog5743(a2);
ERROR 42000: Specified key was too long; max key length is 768 bytes
show warnings;
Level Code Message
Error 1071 Specified key was too long; max key length is 768 bytes
drop table worklog5743;
create table worklog5743(a1 int, a2 varchar(768)) ROW_FORMAT=DYNAMIC;
create index idx1 on worklog5743(a2);
@@ -282,10 +250,8 @@ update worklog5743 set a1 = 3333;
drop table worklog5743;
create table worklog5743(a1 int, a2 varchar(765)) ROW_FORMAT=DYNAMIC;
create index idx1 on worklog5743(a1, a2);
ERROR 42000: Specified key was too long; max key length is 768 bytes
show warnings;
Level Code Message
Error 1071 Specified key was too long; max key length is 768 bytes
drop table worklog5743;
create table worklog5743(a1 int, a2 varchar(764)) ROW_FORMAT=DYNAMIC;
create index idx1 on worklog5743(a1, a2);
@@ -315,8 +281,6 @@ connection default;
rollback;
drop table worklog5743;
### 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 index idx on worklog5743(a(768));
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;
SET sql_mode= '';
create index idx1 on worklog5743(a(769));
Warnings:
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
SET sql_mode= default;
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;
Level Code Message
Note 1831 Duplicate index `idx2`. This is deprecated and will be disallowed in a future release
show create table worklog5743;
Table Create Table
worklog5743 CREATE TABLE `worklog5743` (
`a` text NOT NULL,
KEY `idx1` (`a`(768)),
KEY `idx1` (`a`(769)),
KEY `idx2` (`a`(768))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
insert into worklog5743 values(repeat("a", 768));

View File

@@ -266,7 +266,7 @@ drop table worklog5743_8;
### Test 5 ###
create table worklog5743(a1 int, a2 varchar(20000)) ROW_FORMAT=DYNAMIC;
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;
create table worklog5743(a1 int, a2 varchar(1537)) ROW_FORMAT=DYNAMIC;
create index idx1 on worklog5743(a2);