1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Remove deprecated InnoDB file format parameters

The following options will be removed:

innodb_file_format
innodb_file_format_check
innodb_file_format_max
innodb_large_prefix

They have been deprecated in MySQL 5.7.7 (and MariaDB 10.2.2) in WL#7703.

The file_format column in two INFORMATION_SCHEMA tables will be removed:

innodb_sys_tablespaces
innodb_sys_tables

Code to update the file format tag at the end of page 0:5
(TRX_SYS_PAGE in the InnoDB system tablespace) will be removed.
When initializing a new database, the bytes will remain 0.

All references to the Barracuda file format will be removed.
Some references to the Antelope file format (meaning
ROW_FORMAT=REDUNDANT or ROW_FORMAT=COMPACT) will remain.

This basically ports WL#7704 from MySQL 8.0.0 to MariaDB 10.3.1:

commit 4a69dc2a95995501ed92d59a1de74414a38540c6
Author: Marko Mäkelä <marko.makela@oracle.com>
Date:   Wed Mar 11 22:19:49 2015 +0200
This commit is contained in:
Marko Mäkelä
2017-06-01 13:03:55 +03:00
parent 3d615e4b1a
commit 0c92794db3
112 changed files with 253 additions and 4492 deletions

View File

@ -298,15 +298,6 @@ SHOW WARNINGS;
CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_file_format = `Antelope`;
--error ER_ILLEGAL_HA,1005
CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
--error ER_ILLEGAL_HA,1005
CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
SET GLOBAL innodb_file_format = `Barracuda`;
--echo # Test 7) This series of tests were moved from innodb-index to here
--echo # because the second alter table t1 assumes a 16k page size.

View File

@ -247,15 +247,6 @@ SHOW WARNINGS;
CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_file_format = `Antelope`;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
SET GLOBAL innodb_file_format = `Barracuda`;
--echo # Test 7) Not included here; 16k only

View File

@ -264,15 +264,6 @@ SHOW WARNINGS;
CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_file_format = `Antelope`;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t4 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t5 (id int PRIMARY KEY) ENGINE=innodb KEY_BLOCK_SIZE=16;
SHOW WARNINGS;
SET GLOBAL innodb_file_format = `Barracuda`;
--echo # Test 7) Not included here; 16k only

View File

@ -36,8 +36,7 @@
# 4) KEY_BLOCK_SIZE=1,2,4,8 & 16 are incompatible with COMPACT, DYNAMIC &
# REDUNDANT.
# 5) KEY_BLOCK_SIZE=1,2,4,8 & 16 as well as ROW_FORMAT=COMPRESSED
# are incompatible with innodb_file_format=Antelope
# and innodb_file_per_table=OFF
# are incompatible with innodb_file_per_table=OFF
# 6) KEY_BLOCK_SIZE on an ALTER must occur with ROW_FORMAT=COMPRESSED
# or ROW_FORMAT=DEFAULT if the ROW_FORMAT was previously specified
# as COMPACT, DYNAMIC or REDUNDANT.
@ -49,7 +48,7 @@
# 2. Ignore a bad ROW_FORMAT, defaulting to COMPACT.
# 3. Ignore a valid KEY_BLOCK_SIZE when an incompatible but valid
# ROW_FORMAT is specified.
# 4. If innodb_file_format=Antelope or innodb_file_per_table=OFF
# 4. If innodb_file_per_table=OFF
# it will ignore ROW_FORMAT=COMPRESSED and non-zero KEY_BLOCK_SIZEs.
#
# See InnoDB documentation page "SQL Compression Syntax Warnings and Errors"
@ -61,13 +60,9 @@
-- source include/have_innodb_zip.inc
SET default_storage_engine=InnoDB;
--disable_query_log
# These values can change during the test
LET $innodb_file_format_orig=`select @@innodb_file_format`;
LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
--enable_query_log
SET GLOBAL innodb_file_format=`Barracuda`;
SET GLOBAL innodb_file_per_table=ON;
# The first half of these tests are with strict mode ON.
@ -216,40 +211,9 @@ CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=9;
SHOW WARNINGS;
--echo # Test 7) StrictMode=ON, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and
--echo # and a valid non-zero KEY_BLOCK_SIZE are rejected with Antelope
--echo # and that they can be set to default values during strict mode.
SET GLOBAL innodb_file_format=Antelope;
--error ER_ILLEGAL_HA,1005
CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=4;
SHOW WARNINGS;
--error ER_ILLEGAL_HA,1005
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED;
SHOW WARNINGS;
--error 1005
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=REDUNDANT;
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPACT;
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DEFAULT;
SHOW WARNINGS;
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 KEY_BLOCK_SIZE=2;
SHOW WARNINGS;
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
SHOW WARNINGS;
--error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
SHOW WARNINGS;
SET GLOBAL innodb_file_format=Barracuda;
DROP TABLE t1;
--echo # and a valid non-zero KEY_BLOCK_SIZE
--echo # can be set to default values during strict mode.
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
SET GLOBAL innodb_file_format=Antelope;
ALTER TABLE t1 ADD COLUMN f1 INT;
SHOW CREATE TABLE t1;
SHOW WARNINGS;
@ -257,7 +221,6 @@ ALTER TABLE t1 ROW_FORMAT=DEFAULT KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
ALTER TABLE t1 ADD COLUMN f2 INT;
SHOW WARNINGS;
SET GLOBAL innodb_file_format=Barracuda;
--echo # Test 8) StrictMode=ON, Make sure ROW_FORMAT=COMPRESSED
--echo # and a valid non-zero KEY_BLOCK_SIZE are rejected with
@ -466,18 +429,14 @@ CREATE TABLE t1 ( i INT ) KEY_BLOCK_SIZE=15;
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
--echo # Test 15) StrictMode=OFF, Make sure ROW_FORMAT= COMPRESSED & DYNAMIC and a
--echo valid KEY_BLOCK_SIZE are remembered but not used when ROW_FORMAT
--echo is reverted to Antelope and then used again when ROW_FORMAT=Barracuda.
--echo # Test 15) StrictMode=OFF.
DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
SET GLOBAL innodb_file_format=Antelope;
ALTER TABLE t1 ADD COLUMN f1 INT;
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
SET GLOBAL innodb_file_format=Barracuda;
ALTER TABLE t1 ADD COLUMN f2 INT;
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
@ -485,11 +444,9 @@ DROP TABLE t1;
CREATE TABLE t1 ( i INT ) ROW_FORMAT=DYNAMIC;
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
SET GLOBAL innodb_file_format=Antelope;
ALTER TABLE t1 ADD COLUMN f1 INT;
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
SET GLOBAL innodb_file_format=Barracuda;
ALTER TABLE t1 ADD COLUMN f2 INT;
SHOW WARNINGS;
SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE TABLE_NAME = 't1';
@ -527,6 +484,5 @@ SELECT TABLE_NAME,ROW_FORMAT,CREATE_OPTIONS FROM information_schema.tables WHERE
DROP TABLE t1;
--disable_query_log
EVAL SET GLOBAL innodb_file_format=$innodb_file_format_orig;
EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
--enable_query_log

View File

@ -137,11 +137,6 @@ create table worklog5743_16(a1 int, a2 TEXT, a3 TEXT) KEY_BLOCK_SIZE=16;
# See page_zip_empty_size() and Bug #47495 for more detail.
# Test edge cases for indexes using key_block_size=1
set global innodb_large_prefix=0;
-- error ER_TOO_LONG_KEY,1118
create index idx1 on worklog5743_1(a2(4000));
show warnings;
set global innodb_large_prefix=1;
-- error ER_TOO_LONG_KEY,1118
create index idx2 on worklog5743_1(a2(4000));
show warnings;
@ -159,12 +154,6 @@ create index idx6 on worklog5743_1(a1, a2(428));
show warnings;
# Test edge cases for indexes using key_block_size=2
set global innodb_large_prefix=0;
# Check index creation behavior without STRICT mode
SET sql_mode= '';
create index idx1 on worklog5743_2(a2(4000));
show warnings;
set global innodb_large_prefix=1;
-- error ER_TOO_BIG_ROWSIZE
create index idx2 on worklog5743_2(a2(4000));
show warnings;
@ -182,10 +171,6 @@ create index idx6 on worklog5743_2(a1, a2(940));
show warnings;
# Test edge cases for indexes using key_block_size=4
set global innodb_large_prefix=0;
create index idx1 on worklog5743_4(a2(4000));
show warnings;
set global innodb_large_prefix=1;
-- error ER_TOO_BIG_ROWSIZE
create index idx2 on worklog5743_4(a2(4000));
show warnings;
@ -203,10 +188,6 @@ create index idx6 on worklog5743_4(a1, a2(1964));
show warnings;
# Test edge cases for indexes using key_block_size=8
set global innodb_large_prefix=0;
create index idx1 on worklog5743_8(a2(1000));
show warnings;
set global innodb_large_prefix=1;
create index idx2 on worklog5743_8(a2(3073));
show warnings;
create index idx3 on worklog5743_8(a2(3072));
@ -223,10 +204,6 @@ create index idx7 on worklog5743_8(a1, a2(2000), a3(1068));
show warnings;
# Test edge cases for indexes using key_block_size=16
set global innodb_large_prefix=0;
create index idx1 on worklog5743_16(a2(1000));
show warnings;
set global innodb_large_prefix=1;
create index idx2 on worklog5743_16(a2(3073));
show warnings;
create index idx3 on worklog5743_16(a2(3072));
@ -250,16 +227,6 @@ insert into worklog5743_4 values(9, repeat("a", 10000));
insert into worklog5743_8 values(9, repeat("a", 10000), repeat("a", 10000));
insert into worklog5743_16 values(9, repeat("a", 10000), repeat("a", 10000));
# Now if we change the global innodb_large_prefix back to 767,
# updates to these indexes should still be allowed.
set global innodb_large_prefix=0;
insert into worklog5743_1 values(2, repeat("b", 10000));
insert into worklog5743_2 values(2, repeat("b", 10000));
insert into worklog5743_4 values(2, repeat("b", 10000));
insert into worklog5743_8 values(2, repeat("b", 10000), repeat("b", 10000));
insert into worklog5743_16 values(2, repeat("b", 10000), repeat("b", 10000));
set global innodb_large_prefix=1;
select a1, left(a2, 20) from worklog5743_1;
select a1, left(a2, 20) from worklog5743_2;
select a1, left(a2, 20) from worklog5743_4;

View File

@ -136,8 +136,7 @@ create table worklog5743_4(a1 int, a2 TEXT not null) KEY_BLOCK_SIZE=4;
# See page_zip_empty_size() and Bug #47495 for more detail.
# Test edge cases for indexes using key_block_size=1
set global innodb_large_prefix=0;
-- error ER_TOO_LONG_KEY
-- error ER_TOO_BIG_ROWSIZE
create index idx1 on worklog5743_1(a2(4000));
show warnings;
-- error ER_TOO_BIG_ROWSIZE
@ -154,7 +153,6 @@ create index idx6 on worklog5743_1(a1, a2(428));
show warnings;
# Test edge cases for indexes using key_block_size=2
set global innodb_large_prefix=1;
SET sql_mode= '';
create index idx1 on worklog5743_2(a2(4000));
show warnings;
@ -169,7 +167,6 @@ show warnings;
create index idx6 on worklog5743_2(a1, a2(764));
show warnings;
# Test edge cases for indexes using key_block_size=4
set global innodb_large_prefix=0;
create index idx1 on worklog5743_4(a2(4000));
show warnings;
show create table worklog5743_4;
@ -188,14 +185,6 @@ insert into worklog5743_1 values(9, repeat("a", 10000));
insert into worklog5743_2 values(9, repeat("a", 10000));
insert into worklog5743_4 values(9, repeat("a", 10000));
# Now if we change the global innodb_large_prefix back to 767,
# updates to these indexes should still be allowed.
set global innodb_large_prefix=0;
insert into worklog5743_1 values(2, repeat("b", 10000));
insert into worklog5743_2 values(2, repeat("b", 10000));
insert into worklog5743_4 values(2, repeat("b", 10000));
set global innodb_large_prefix=1;
select a1, left(a2, 20) from worklog5743_1;
select a1, left(a2, 20) from worklog5743_2;
select a1, left(a2, 20) from worklog5743_4;

View File

@ -138,12 +138,7 @@ create table worklog5743_8(a1 int, a2 TEXT, a3 TEXT) KEY_BLOCK_SIZE=8;
# See page_zip_empty_size() and Bug #47495 for more detail.
# Test edge cases for indexes using key_block_size=1
set global innodb_large_prefix=0;
-- error ER_TOO_LONG_KEY
create index idx1 on worklog5743_1(a2(4000));
show warnings;
set global innodb_large_prefix=1;
-- error ER_TOO_LONG_KEY
-- error ER_TOO_BIG_ROWSIZE
create index idx2 on worklog5743_1(a2(4000));
show warnings;
-- error ER_TOO_BIG_ROWSIZE
@ -160,11 +155,6 @@ create index idx6 on worklog5743_1(a1, a2(428));
show warnings;
# Test edge cases for indexes using key_block_size=2
set global innodb_large_prefix=0;
SET sql_mode= '';
create index idx1 on worklog5743_2(a2(4000));
show warnings;
set global innodb_large_prefix=1;
-- error ER_TOO_BIG_ROWSIZE
create index idx2 on worklog5743_2(a2(4000));
show warnings;
@ -182,10 +172,6 @@ create index idx6 on worklog5743_2(a1, a2(940));
show warnings;
# Test edge cases for indexes using key_block_size=4
set global innodb_large_prefix=0;
create index idx1 on worklog5743_4(a2(4000));
show warnings;
set global innodb_large_prefix=1;
create index idx3 on worklog5743_4(a2(1537));
show warnings;
create index idx4 on worklog5743_4(a2(1536));
@ -197,10 +183,6 @@ create index idx6 on worklog5743_4(a1, a2(1532));
show warnings;
# Test edge cases for indexes using key_block_size=8
set global innodb_large_prefix=0;
create index idx1 on worklog5743_8(a2(1000));
show warnings;
set global innodb_large_prefix=1;
create index idx2 on worklog5743_8(a2(3073));
show warnings;
create index idx3 on worklog5743_8(a2(3072));
@ -218,15 +200,6 @@ insert into worklog5743_2 values(9, repeat("a", 10000));
insert into worklog5743_4 values(9, repeat("a", 10000));
insert into worklog5743_8 values(9, repeat("a", 10000), repeat("a", 10000));
# Now if we change the global innodb_large_prefix back to 767,
# updates to these indexes should still be allowed.
set global innodb_large_prefix=0;
insert into worklog5743_1 values(2, repeat("b", 10000));
insert into worklog5743_2 values(2, repeat("b", 10000));
insert into worklog5743_4 values(2, repeat("b", 10000));
insert into worklog5743_8 values(2, repeat("b", 10000), repeat("b", 10000));
set global innodb_large_prefix=1;
select a1, left(a2, 20) from worklog5743_1;
select a1, left(a2, 20) from worklog5743_2;
select a1, left(a2, 20) from worklog5743_4;

View File

@ -7,17 +7,12 @@ SELECT table_name, row_format, data_length, index_length
WHERE table_schema='mysqltest_innodb_zip';
let $per_table=`select @@innodb_file_per_table`;
let $format=`select @@innodb_file_format`;
let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
let $innodb_file_format_orig=`select @@innodb_file_format`;
let $innodb_file_format_max_orig=`select @@innodb_file_format_max`;
SET @save_innodb_stats_on_metadata=@@global.innodb_stats_on_metadata;
--let $query_i_s = SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql'
set session innodb_strict_mode=0;
set global innodb_file_per_table=off;
set global innodb_file_format=`0`;
SET @@global.innodb_stats_on_metadata=ON;
create table t0(a int primary key) engine=innodb row_format=compressed;
@ -33,7 +28,6 @@ key_block_size=1 row_format=redundant;
set global innodb_file_per_table=on;
create table t6(a int primary key) engine=innodb
key_block_size=1 row_format=redundant;
set global innodb_file_format=`1`;
create table t7(a int primary key) engine=innodb
key_block_size=1 row_format=redundant;
create table t8(a int primary key) engine=innodb
@ -129,34 +123,7 @@ select count(*) from t1 where c4 = repeat('C', 20000);
update t1 set c3 = repeat('E', 20000) where c1 = 1;
drop table t1;
#
#
# Test innodb_file_format
#
set global innodb_file_format=`0`;
select @@innodb_file_format;
set global innodb_file_format=`1`;
select @@innodb_file_format;
-- error ER_WRONG_VALUE_FOR_VAR
set global innodb_file_format=`2`;
-- error ER_WRONG_VALUE_FOR_VAR
set global innodb_file_format=`-1`;
set global innodb_file_format=`Antelope`;
set global innodb_file_format=`Barracuda`;
-- error ER_WRONG_VALUE_FOR_VAR
set global innodb_file_format=`Cheetah`;
-- error ER_WRONG_VALUE_FOR_VAR
set global innodb_file_format=`abc`;
-- error ER_WRONG_VALUE_FOR_VAR
set global innodb_file_format=`1a`;
-- error ER_WRONG_VALUE_FOR_VAR
set global innodb_file_format=``;
#test strict mode.
# this does not work anymore, has been removed from mysqltest
# -- enable_errors
set global innodb_file_per_table = on;
set global innodb_file_format = `1`;
set innodb_strict_mode = off;
create table t1 (id int primary key) engine = innodb key_block_size = 0;
@ -283,80 +250,12 @@ create table t9 (id int primary key) engine = innodb row_format = redundant;
--eval $query_i_s
drop table t7, t8, t9;
#test valid values with innodb_file_format unset
set global innodb_file_per_table = on;
set global innodb_file_format = `0`;
--replace_regex / - .*[0-9]*[)]/)/
--error ER_CANT_CREATE_TABLE
create table t1 (id int primary key) engine = innodb key_block_size = 1;
--replace_regex / - .*[0-9]*[)]/)/
show warnings;
--replace_regex / - .*[0-9]*[)]/)/
--error ER_CANT_CREATE_TABLE
create table t2 (id int primary key) engine = innodb key_block_size = 2;
--replace_regex / - .*[0-9]*[)]/)/
show warnings;
--replace_regex / - .*[0-9]*[)]/)/
--error ER_CANT_CREATE_TABLE
create table t3 (id int primary key) engine = innodb key_block_size = 4;
show warnings;
# Tests for key_block_size = 8 and 16 were moved to innodb_16k, innodb_8k
# and innodb_4k since they get different warnings with smaller page sizes.
--error ER_CANT_CREATE_TABLE
create table t6 (id int primary key) engine = innodb row_format = compressed;
--replace_regex / - .*[0-9]*[)]/)/
show warnings;
--replace_regex / - .*[0-9]*[)]/)/
--error ER_CANT_CREATE_TABLE
create table t7 (id int primary key) engine = innodb row_format = dynamic;
--replace_regex / - .*[0-9]*[)]/)/
show warnings;
create table t8 (id int primary key) engine = innodb row_format = compact;
create table t9 (id int primary key) engine = innodb row_format = redundant;
--replace_result 16384 {valid} 8192 {valid} 4096 {valid}
--eval $query_i_s
drop table t8, t9;
eval set global innodb_file_per_table=$per_table;
eval set global innodb_file_format=$format;
#
# Testing of tablespace tagging
#
-- disable_info
set global innodb_file_per_table=on;
set global innodb_file_format=`Barracuda`;
set global innodb_file_format_max=`Antelope`;
create table normal_table (
c1 int
) engine = innodb;
select @@innodb_file_format_max;
create table zip_table (
c1 int
) engine = innodb key_block_size = 4;
select @@innodb_file_format_max;
set global innodb_file_format_max=`Antelope`;
select @@innodb_file_format_max;
-- disable_result_log
show table status;
-- enable_result_log
select @@innodb_file_format_max;
drop table normal_table, zip_table;
-- disable_result_log
#
# restore environment to the state it was before this test execution
#
-- disable_query_log
eval set global innodb_file_format=$format;
eval set global innodb_file_per_table=$per_table;
eval set session innodb_strict_mode=$innodb_strict_mode_orig;
eval SET GLOBAL innodb_file_format=$innodb_file_format_orig;
eval SET GLOBAL innodb_file_format_max=$innodb_file_format_max_orig;
SET @@global.innodb_stats_on_metadata=@save_innodb_stats_on_metadata;
--enable_query_log

View File

@ -1 +0,0 @@
--innodb_large_prefix=ON

View File

@ -5,13 +5,11 @@
-- source include/not_encrypted.inc
let $per_table=`select @@innodb_file_per_table`;
let $format=`select @@innodb_file_format`;
-- let $query_i_s = SELECT page_size FROM information_schema.innodb_cmpmem WHERE pages_used > 0
set global innodb_file_per_table=on;
set global innodb_file_format=`1`;
create table t1(a text) engine=innodb key_block_size=8;
-- disable_query_log
@ -59,5 +57,4 @@ drop table t2;
#
-- disable_query_log
eval set global innodb_file_format=$format;
eval set global innodb_file_per_table=$per_table;

View File

@ -1,434 +0,0 @@
# Testcase for worklog #5743: Lift the limit of index key prefixes
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
SET default_storage_engine=InnoDB;
call mtr.add_suppression("Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page.");
let $innodb_large_prefix_orig=`select @@innodb_large_prefix`;
set global innodb_large_prefix=1;
set global innodb_strict_mode=1;
-- echo ### Test 1 ###
# Create a table of DYNAMIC format, with a primary index of 1000 bytes in
# size
create table worklog5743(a TEXT not null, primary key (a(1000))) ROW_FORMAT=DYNAMIC;
show warnings;
# Do some insertion and update to excercise the external cache
# code path
insert into worklog5743 values(repeat("a", 20000));
# default session, update the table
update worklog5743 set a = (repeat("b", 16000));
# Create a secondary index
create index idx on worklog5743(a(2000));
show warnings;
# Start a few sessions to do selections on table being updated in default
# session, so it would rebuild the previous version from undo log.
# 1) Default session: Initiate an update on the externally stored column
# 2) Session con1: Select from table with repeated read
# 3) Session con2: Select from table with read uncommitted
# 4) Default session: rollback updates
begin;
update worklog5743 set a = (repeat("x", 17000));
# Start a new session to select the column to force it build
# an earlier version of the clustered index through undo log. So it should
# just see the result of repeat("b", 16000)
select @@session.tx_isolation;
--connect (con1,localhost,root,,)
select a = repeat("x", 17000) from worklog5743;
select a = repeat("b", 16000) from worklog5743;
# Start another session doing "read uncommitted" query, it
# should see the uncommitted update
--connect (con2,localhost,root,,)
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
select @@session.tx_isolation;
select a = repeat("x", 17000) from worklog5743;
# Roll back the transaction
--connection default
rollback;
drop table worklog5743;
-- echo ### Test 2 ###
# Create a table with only a secondary index has large prefix column
create table worklog5743(a1 int, a2 TEXT not null) ROW_FORMAT=DYNAMIC;
show warnings;
create index idx on worklog5743(a1, a2(2000));
show warnings;
insert into worklog5743 values(9, repeat("a", 10000));
begin;
update worklog5743 set a1 = 1000;
# Do a select from another connection that would use the secondary index
--connection con1
select @@session.tx_isolation;
explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
# Do read uncommitted in another session, it would show there is no
# row with a1 = 9
--connection con2
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
select @@session.tx_isolation;
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
--connection default
rollback;
drop table worklog5743;
-- echo ### Test 3 ###
# Create a table with a secondary index has small (50 bytes) prefix column
create table worklog5743(a1 int, a2 TEXT not null) ROW_FORMAT=DYNAMIC;
create index idx on worklog5743(a1, a2(50));
insert into worklog5743 values(9, repeat("a", 10000));
begin;
update worklog5743 set a1 = 1000;
# Do a select from another connection that would use the secondary index
--connection con1
select @@session.tx_isolation;
explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
# Do read uncommitted in another session, it would show there is no
# row with a1 = 9
--connection con2
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
select @@session.tx_isolation;
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
--connection default
rollback;
drop table worklog5743;
-- echo ### Test 4 ###
# Create compressed tables with each KEY_BLOCK_SIZE.
create table worklog5743_1(a1 int, a2 TEXT not null) KEY_BLOCK_SIZE=1;
create table worklog5743_2(a1 int, a2 TEXT not null) KEY_BLOCK_SIZE=2;
create table worklog5743_4(a1 int, a2 TEXT not null) KEY_BLOCK_SIZE=4;
create table worklog5743_8(a1 int, a2 TEXT, a3 TEXT) KEY_BLOCK_SIZE=8;
create table worklog5743_16(a1 int, a2 TEXT, a3 TEXT) KEY_BLOCK_SIZE=16;
# The maximum overall index record (not prefix) length of a
# compressed table is dependent on innodb-page-size (IPS),
# key_block_size (KBS) and the number of fields (NF).
# "Too big row" error (HA_ERR_TO_BIG_ROW) will be returned if this
# limit is exceeded.
# See page_zip_empty_size() and Bug #47495 for more detail.
# Test edge cases for indexes using key_block_size=1
set sql_mode='';
set global innodb_large_prefix=0;
-- error ER_TOO_BIG_ROWSIZE
create index idx1 on worklog5743_1(a2(4000));
show warnings;
set global innodb_large_prefix=1;
-- error ER_TOO_BIG_ROWSIZE
create index idx2 on worklog5743_1(a2(4000));
show warnings;
-- error ER_TOO_BIG_ROWSIZE
create index idx3 on worklog5743_1(a2(436));
show warnings;
# Bug#13391353 Limit is one byte less on on 32bit-Linux only
create index idx4 on worklog5743_1(a2(434));
show warnings;
-- error ER_TOO_BIG_ROWSIZE
create index idx5 on worklog5743_1(a1, a2(430));
show warnings;
# Bug#13391353 Limit is one byte less on on 32bit-Linux only
create index idx6 on worklog5743_1(a1, a2(428));
show warnings;
# Test edge cases for indexes using key_block_size=2
set global innodb_large_prefix=0;
create index idx1 on worklog5743_2(a2(4000));
show warnings;
set global innodb_large_prefix=1;
-- error ER_TOO_BIG_ROWSIZE
create index idx2 on worklog5743_2(a2(4000));
show warnings;
-- error ER_TOO_BIG_ROWSIZE
create index idx3 on worklog5743_2(a2(948));
show warnings;
# Bug#13391353 Limit is one byte less on on 32bit-Linux only
create index idx4 on worklog5743_2(a2(946));
show warnings;
-- error ER_TOO_BIG_ROWSIZE
create index idx5 on worklog5743_2(a1, a2(942));
show warnings;
# Bug#13391353 Limit is one byte less on on 32bit-Linux only
create index idx6 on worklog5743_2(a1, a2(940));
show warnings;
# Test edge cases for indexes using key_block_size=4
set global innodb_large_prefix=0;
create index idx1 on worklog5743_4(a2(4000));
show warnings;
set global innodb_large_prefix=1;
-- error ER_TOO_BIG_ROWSIZE
create index idx2 on worklog5743_4(a2(4000));
show warnings;
-- error ER_TOO_BIG_ROWSIZE
create index idx3 on worklog5743_4(a2(1972));
show warnings;
# Bug#13391353 Limit is one byte less on on 32bit-Linux only
create index idx4 on worklog5743_4(a2(1970));
show warnings;
-- error ER_TOO_BIG_ROWSIZE
create index idx5 on worklog5743_4(a1, a2(1966));
show warnings;
# Bug#13391353 Limit is one byte less on on 32bit-Linux only
create index idx6 on worklog5743_4(a1, a2(1964));
show warnings;
# Test edge cases for indexes using key_block_size=8
set global innodb_large_prefix=0;
create index idx1 on worklog5743_8(a2(1000));
show warnings;
set global innodb_large_prefix=1;
create index idx2 on worklog5743_8(a2(3073));
show warnings;
create index idx3 on worklog5743_8(a2(3072));
show warnings;
-- error ER_TOO_LONG_KEY
create index idx4 on worklog5743_8(a1, a2(3069));
show warnings;
create index idx5 on worklog5743_8(a1, a2(3068));
show warnings;
-- error ER_TOO_LONG_KEY
create index idx6 on worklog5743_8(a1, a2(2000), a3(1069));
show warnings;
create index idx7 on worklog5743_8(a1, a2(2000), a3(1068));
show warnings;
# Test edge cases for indexes using key_block_size=16
set global innodb_large_prefix=0;
create index idx1 on worklog5743_16(a2(1000));
show warnings;
set global innodb_large_prefix=1;
create index idx2 on worklog5743_16(a2(3073));
show warnings;
create index idx3 on worklog5743_16(a2(3072));
show warnings;
-- error ER_TOO_LONG_KEY
create index idx4 on worklog5743_16(a1, a2(3069));
show warnings;
create index idx5 on worklog5743_16(a1, a2(3068));
show warnings;
-- error ER_TOO_LONG_KEY
create index idx6 on worklog5743_16(a1, a2(2000), a3(1069));
show warnings;
create index idx7 on worklog5743_16(a1, a2(2000), a3(1068));
show warnings;
set sql_mode=default;
# Insert a large record into each of these tables.
insert into worklog5743_1 values(9, repeat("a", 10000));
insert into worklog5743_2 values(9, repeat("a", 10000));
insert into worklog5743_4 values(9, repeat("a", 10000));
insert into worklog5743_8 values(9, repeat("a", 10000), repeat("a", 10000));
insert into worklog5743_16 values(9, repeat("a", 10000), repeat("a", 10000));
# Now if we change the global innodb_large_prefix back to 767,
# updates to these indexes should still be allowed.
set global innodb_large_prefix=0;
insert into worklog5743_1 values(2, repeat("b", 10000));
insert into worklog5743_2 values(2, repeat("b", 10000));
insert into worklog5743_4 values(2, repeat("b", 10000));
insert into worklog5743_8 values(2, repeat("b", 10000), repeat("b", 10000));
insert into worklog5743_16 values(2, repeat("b", 10000), repeat("b", 10000));
set global innodb_large_prefix=1;
select a1, left(a2, 20) from worklog5743_1;
select a1, left(a2, 20) from worklog5743_2;
select a1, left(a2, 20) from worklog5743_4;
select a1, left(a2, 20) from worklog5743_8;
select a1, left(a2, 20) from worklog5743_16;
begin;
update worklog5743_1 set a1 = 1000;
update worklog5743_2 set a1 = 1000;
update worklog5743_4 set a1 = 1000;
update worklog5743_8 set a1 = 1000;
update worklog5743_16 set a1 = 1000;
select a1, left(a2, 20) from worklog5743_1;
select a1, left(a2, 20) from worklog5743_2;
select a1, left(a2, 20) from worklog5743_4;
select a1, left(a2, 20) from worklog5743_8;
select a1, left(a2, 20) from worklog5743_16;
# Do a select from another connection that would use the secondary index
--connection con1
select @@session.tx_isolation;
explain select a1, left(a2, 20) from worklog5743_1 where a1 = 9;
explain select a1, left(a2, 20) from worklog5743_2 where a1 = 9;
explain select a1, left(a2, 20) from worklog5743_4 where a1 = 9;
explain select a1, left(a2, 20) from worklog5743_8 where a1 = 9;
explain select a1, left(a2, 20) from worklog5743_16 where a1 = 9;
select a1, left(a2, 20) from worklog5743_1 where a1 = 9;
select a1, left(a2, 20) from worklog5743_2 where a1 = 9;
select a1, left(a2, 20) from worklog5743_4 where a1 = 9;
select a1, left(a2, 20) from worklog5743_8 where a1 = 9;
select a1, left(a2, 20) from worklog5743_16 where a1 = 9;
# Do read uncommitted in another session, it would show there is no
# row with a1 = 9
--connection con2
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
select @@session.tx_isolation;
select a1, left(a2, 20) from worklog5743_1 where a1 = 9;
select a1, left(a2, 20) from worklog5743_2 where a1 = 9;
select a1, left(a2, 20) from worklog5743_4 where a1 = 9;
select a1, left(a2, 20) from worklog5743_8 where a1 = 9;
select a1, left(a2, 20) from worklog5743_16 where a1 = 9;
--connection default
rollback;
drop table worklog5743_1;
drop table worklog5743_2;
drop table worklog5743_4;
drop table worklog5743_8;
drop table worklog5743_16;
-- echo ### Test 5 ###
# Create a table with large varchar columns and create indexes
# directly on these large columns to show that prefix limit is
# automatically applied and to show that limit.
create table worklog5743(a1 int,
a2 varchar(20000),
a3 varchar(3073),
a4 varchar(3072),
a5 varchar(3069),
a6 varchar(3068))
ROW_FORMAT=DYNAMIC;
set sql_mode='';
create index idx1 on worklog5743(a2);
create index idx2 on worklog5743(a3);
create index idx3 on worklog5743(a4);
show warnings;
-- error ER_TOO_LONG_KEY
create index idx4 on worklog5743(a1, a2);
show warnings;
-- error ER_TOO_LONG_KEY
create index idx5 on worklog5743(a1, a5);
show warnings;
create index idx6 on worklog5743(a1, a6);
show warnings;
show create table worklog5743;
set sql_mode=default;
insert into worklog5743 values(9,
repeat("a", 20000), repeat("a", 3073),
repeat("a", 3072), repeat("a", 3069),
repeat("a", 3068));
begin;
update worklog5743 set a1 = 1000;
# Do a select from another connection that would use the secondary index
--connection con1
select @@session.tx_isolation;
explain select a1 from worklog5743 where a1 = 9;
select a1 from worklog5743 where a1 = 9;
# Do read uncommitted, it would show there is no row with a1 = 9
--connection con2
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
select @@session.tx_isolation;
select a1 from worklog5743 where a1 = 9;
--connection default
rollback;
drop table worklog5743;
-- echo ### Test 6 ###
# Create a table with old format, and the limit is 768 bytes.
-- error ER_INDEX_COLUMN_TOO_LONG
create table worklog5743(a TEXT not null, primary key (a(1000))) row_format=COMPACT;
create table worklog5743(a TEXT) row_format=COMPACT;
# Excercise the column length check in ha_innobase::add_index()
-- error ER_INDEX_COLUMN_TOO_LONG
create index idx on worklog5743(a(768));
# This should be successful
create index idx on worklog5743(a(767));
# Perform some DMLs
insert into worklog5743 values(repeat("a", 20000));
begin;
insert into worklog5743 values(repeat("b", 20000));
update worklog5743 set a = (repeat("x", 25000));
# Start a new session to select the table to force it build
# an earlier version of the cluster index through undo log
select @@session.tx_isolation;
--connection con1
select a = repeat("a", 20000) from worklog5743;
--disconnect con1
--connection con2
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
select @@session.tx_isolation;
select a = repeat("x", 25000) from worklog5743;
--disconnect con2
--connection default
rollback;
drop table worklog5743;
-- echo ### Test 7 ###
# Some border line tests on the column length.
# We have a limit of 3072 bytes for Barracuda table
create table worklog5743(a TEXT not null) ROW_FORMAT=DYNAMIC;
# Length exceeds maximum supported key length
# It will be auto-truncated to 3072
set statement sql_mode = '' for
create index idx1 on worklog5743(a(3073));
create index idx2 on worklog5743(a(3072));
show create table worklog5743;
drop table worklog5743;
# We have a limit of 767 bytes for Antelope tables
create table worklog5743(a TEXT not null) ROW_FORMAT=REDUNDANT;
-- error ER_INDEX_COLUMN_TOO_LONG
create index idx on worklog5743(a(768));
create index idx2 on worklog5743(a(767));
drop table worklog5743;
create table worklog5743(a TEXT not null) ROW_FORMAT=COMPACT;
-- error ER_INDEX_COLUMN_TOO_LONG
create index idx on worklog5743(a(768));
create index idx2 on worklog5743(a(767));
drop table worklog5743;
eval SET GLOBAL innodb_large_prefix=$innodb_large_prefix_orig;
SET GLOBAL innodb_strict_mode = DEFAULT;