Commit d4fd4ae4 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-21679 innodb_zip.index_large_prefix_4k fails with ER_TOO_BIG_ROWSIZE

The test innodb_zip.index_large_prefix_4k would not run unless it is
invoked as
./mtr --mysqld=--innodb-page-size=4k innodb_zip.index_large_prefix_4k

This test was originally developed to cover an option that was removed
in commit 0c92794d. Starting with
MariaDB Server 10.2, which introduced innodb_default_row_format=dynamic,
the option innodb_large_prefix had become useless.

Let us remove some of the stale tests and adjust the outcome to the
expected behaviour.
parent 86f6129c
...@@ -8,11 +8,8 @@ insert into worklog5743 values(repeat("a", 20000)); ...@@ -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)); ...@@ -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
...@@ -120,69 +117,54 @@ create index idx6 on worklog5743_1(a1, a2(428)); ...@@ -120,69 +117,54 @@ create index idx6 on worklog5743_1(a1, a2(428));
show warnings; show warnings;
Level Code Message Level Code Message
SET sql_mode= ''; SET sql_mode= '';
set innodb_strict_mode=off;
create index idx1 on worklog5743_2(a2(4000)); create index idx1 on worklog5743_2(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
Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
set innodb_strict_mode=on;
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
Warning 139 Row size too large (> 1982). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.
show create table worklog5743_2; show create table worklog5743_2;
Table Create Table Table Create Table
worklog5743_2 CREATE TABLE `worklog5743_2` ( worklog5743_2 CREATE TABLE `worklog5743_2` (
`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=2 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci KEY_BLOCK_SIZE=2
drop index idx1 on worklog5743_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 idx6 on worklog5743_2(a1, a2(768));
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; show warnings;
Level Code Message Level Code Message
set innodb_strict_mode=off;
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
set innodb_strict_mode=on;
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 COLLATE=latin1_swedish_ci 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;
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; 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
...@@ -253,25 +235,23 @@ drop table worklog5743_4; ...@@ -253,25 +235,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 Note 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 +262,8 @@ update worklog5743 set a1 = 3333; ...@@ -282,10 +262,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);
...@@ -316,7 +294,7 @@ rollback; ...@@ -316,7 +294,7 @@ rollback;
drop table worklog5743; drop table worklog5743;
### Test 6 ### ### Test 6 ###
create table worklog5743(a TEXT not null, primary key (a(1000))); create table worklog5743(a TEXT not null, primary key (a(1000)));
ERROR 42000: Specified key was too long; max key length is 768 bytes drop table worklog5743;
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,25 +328,19 @@ drop table worklog5743; ...@@ -350,25 +328,19 @@ 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 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC
insert into worklog5743 values(repeat("a", 768)); insert into worklog5743 values(repeat("a", 768));
drop table worklog5743; drop table worklog5743;
create table worklog5743(a TEXT not null) ROW_FORMAT=REDUNDANT; create table worklog5743(a TEXT not null) ROW_FORMAT=REDUNDANT;
......
...@@ -154,29 +154,28 @@ show warnings; ...@@ -154,29 +154,28 @@ 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= '';
set innodb_strict_mode=off;
create index idx1 on worklog5743_2(a2(4000)); create index idx1 on worklog5743_2(a2(4000));
set innodb_strict_mode=on;
show warnings; show warnings;
show create table worklog5743_2; show create table worklog5743_2;
drop index idx1 on 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 idx6 on worklog5743_2(a1, a2(768));
create index idx5 on worklog5743_2(a1, a2(765));
show warnings;
create index idx6 on worklog5743_2(a1, a2(764));
show warnings; show warnings;
# Test edge cases for indexes using key_block_size=4 # Test edge cases for indexes using key_block_size=4
set innodb_strict_mode=off;
create index idx1 on worklog5743_4(a2(4000)); create index idx1 on worklog5743_4(a2(4000));
set innodb_strict_mode=on;
show warnings; show warnings;
show create table worklog5743_4; show create table worklog5743_4;
create index idx3 on worklog5743_4(a2(769)); 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));
show warnings;
create index idx6 on worklog5743_4(a1, a2(764)); create index idx6 on worklog5743_4(a1, a2(764));
show warnings; show warnings;
SET sql_mode= default; SET sql_mode= default;
...@@ -272,7 +271,6 @@ show warnings; ...@@ -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; ...@@ -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,9 +313,8 @@ rollback; ...@@ -316,9 +313,8 @@ 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 not null, primary key (a(1000)));
drop table worklog5743;
create table worklog5743(a TEXT) ROW_FORMAT=COMPACT; create table worklog5743(a TEXT) ROW_FORMAT=COMPACT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment