MDEV-20194 Warnings inconsistently issued upon CHECK on table from older versions

The following condition has to added:
1) InnoDB fails to include the offset of the node pointer field
in non-leaf record for redundant row format.

2) If the Fixed length field does have only prefix length then
calculate the field maximum size as prefix length.

- Added the test case to test (2) and to check maximum number of
fields can exist in the index.
parent 84b13506
......@@ -15,31 +15,71 @@ col_1 TEXT
,col_11 TEXT
) ENGINE=INNODB ROW_FORMAT=COMPACT;
Warnings:
Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
TRUNCATE TABLE t1;
Warnings:
Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
Warnings:
Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
ALTER TABLE t1 FORCE;
Warnings:
Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
SET innodb_strict_mode = ON;
TRUNCATE TABLE t1;
Warnings:
Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
Warnings:
Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
ALTER TABLE t1 FORCE;
Warnings:
Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
Warning 139 Row size too large (> NNNN). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
DROP TABLE t1;
SET @@global.log_warnings = 2;
#
# MDEV-20194 Warnings inconsistently issued upon CHECK on
# table from older versions
#
set global innodb_compression_level=1;
CREATE TABLE t1(
f1 INT, f2 CHAR(200), f3 CHAR(200),
f4 CHAR(200), f5 CHAR(200), f6 CHAR(200),
f7 CHAR(200), f8 CHAR(200), f9 CHAR(200),
f10 CHAR(200), PRIMARY KEY(f1, f2(20), f3(20), f4(20))
) ROW_FORMAT=COMPRESSED, ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, repeat('a', 200), repeat('b', 200),
repeat('c', 200), repeat('d', 200),
repeat('d', 200), repeat('e', 200),
repeat('e', 200), repeat('f', 200),
repeat('g', 200) FROM seq_1_to_20;
DROP TABLE t1;
set global innodb_compression_level=default;
CREATE TABLE t1(f1 char(200), f2 char(200), f3 char(200),
f4 char(200), f5 char(200), f6 char(200),
f7 char(200), f8 char(200), f9 char(200),
f10 char(200), f11 char(200), f12 char(200),
f13 char(200), f14 char(200), f15 char(200),
f16 char(200), f17 char(200), f18 char(200),
f19 char(200), f20 char(200), f21 char(200),
f22 char(200), f23 char(200), f24 char(200),
f25 char(200), f26 char(200), f27 char(200),
f28 char(200), f29 char(200), f30 char(200),
f31 char(200), f32 char(200), f33 char(200),
primary key(f1(10), f2(10), f3(10), f4(10),
f5(10), f6(10), f7(10), f8(10),
f9(10), f10(10), f11(10), f12(10),
f13(10), f14(10), f15(10), f16(10),
f17(10), f18(10), f19(10), f20(10),
f21(10), f22(10), f23(10), f24(10),
f25(10), f26(10), f27(10), f28(10),
f29(10), f30(10), f31(10), f32(10),
f33(10)))
ENGINE=InnoDB;
ERROR 42000: Too many key parts specified; max 32 parts allowed
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/innodb_page_size_small.inc
call mtr.add_suppression("InnoDB: 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.");
SET innodb_strict_mode = 0;
SET @@global.log_warnings = 3;
# Check the Warning | 139 | Row size too large (> 16318)
--replace_regex /> [0-9]+/> NNNN/
CREATE TABLE t1 (
col_1 TEXT
,col_2 TEXT
......@@ -19,14 +23,65 @@ CREATE TABLE t1 (
,col_11 TEXT
) ENGINE=INNODB ROW_FORMAT=COMPACT;
--enable_warnings
--replace_regex /> [0-9]+/> NNNN/
TRUNCATE TABLE t1;
--replace_regex /> [0-9]+/> NNNN/
OPTIMIZE TABLE t1;
--replace_regex /> [0-9]+/> NNNN/
ALTER TABLE t1 FORCE;
SET innodb_strict_mode = ON;
--replace_regex /> [0-9]+/> NNNN/
TRUNCATE TABLE t1;
--replace_regex /> [0-9]+/> NNNN/
OPTIMIZE TABLE t1;
--replace_regex /> [0-9]+/> NNNN/
ALTER TABLE t1 FORCE;
DROP TABLE t1;
--disable_warnings
SET @@global.log_warnings = 2;
--echo #
--echo # MDEV-20194 Warnings inconsistently issued upon CHECK on
--echo # table from older versions
--echo #
set global innodb_compression_level=1;
CREATE TABLE t1(
f1 INT, f2 CHAR(200), f3 CHAR(200),
f4 CHAR(200), f5 CHAR(200), f6 CHAR(200),
f7 CHAR(200), f8 CHAR(200), f9 CHAR(200),
f10 CHAR(200), PRIMARY KEY(f1, f2(20), f3(20), f4(20))
) ROW_FORMAT=COMPRESSED, ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, repeat('a', 200), repeat('b', 200),
repeat('c', 200), repeat('d', 200),
repeat('d', 200), repeat('e', 200),
repeat('e', 200), repeat('f', 200),
repeat('g', 200) FROM seq_1_to_20;
DROP TABLE t1;
set global innodb_compression_level=default;
# Maximum field in the index
--error ER_TOO_MANY_KEY_PARTS
CREATE TABLE t1(f1 char(200), f2 char(200), f3 char(200),
f4 char(200), f5 char(200), f6 char(200),
f7 char(200), f8 char(200), f9 char(200),
f10 char(200), f11 char(200), f12 char(200),
f13 char(200), f14 char(200), f15 char(200),
f16 char(200), f17 char(200), f18 char(200),
f19 char(200), f20 char(200), f21 char(200),
f22 char(200), f23 char(200), f24 char(200),
f25 char(200), f26 char(200), f27 char(200),
f28 char(200), f29 char(200), f30 char(200),
f31 char(200), f32 char(200), f33 char(200),
primary key(f1(10), f2(10), f3(10), f4(10),
f5(10), f6(10), f7(10), f8(10),
f9(10), f10(10), f11(10), f12(10),
f13(10), f14(10), f15(10), f16(10),
f17(10), f18(10), f19(10), f20(10),
f21(10), f22(10), f23(10), f24(10),
f25(10), f26(10), f27(10), f28(10),
f29(10), f30(10), f31(10), f32(10),
f33(10)))
ENGINE=InnoDB;
......@@ -12641,7 +12641,6 @@ bool create_table_info_t::row_size_is_acceptable(
return true;
}
/* FIXME: row size check has some flaws and should be improved */
dict_index_t::record_size_info_t dict_index_t::record_size_info() const
{
ut_ad(!(type & DICT_FTS));
......@@ -12732,6 +12731,8 @@ dict_index_t::record_size_info_t dict_index_t::record_size_info() const
{
/* dict_index_add_col() should guarantee this */
ut_ad(!f.prefix_len || f.fixed_len == f.prefix_len);
if (f.prefix_len)
field_max_size= f.prefix_len;
/* Fixed lengths are not encoded
in ROW_FORMAT=COMPACT. */
goto add_field_size;
......@@ -12785,7 +12786,8 @@ dict_index_t::record_size_info_t dict_index_t::record_size_info() const
unique columns, result.shortest_size equals the size of the
node pointer record minus the node pointer column. */
if (i + 1 == dict_index_get_n_unique_in_tree(this) &&
result.shortest_size + REC_NODE_PTR_SIZE >= page_ptr_max)
result.shortest_size + REC_NODE_PTR_SIZE + (comp ? 0 : 2) >=
page_ptr_max)
{
result.set_too_big(i);
}
......
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