Skip to content

Commit 372b0e6

Browse files
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.
1 parent 84b1350 commit 372b0e6

File tree

3 files changed

+106
-9
lines changed

3 files changed

+106
-9
lines changed

mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,71 @@ col_1 TEXT
1515
,col_11 TEXT
1616
) ENGINE=INNODB ROW_FORMAT=COMPACT;
1717
Warnings:
18-
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.
18+
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.
1919
TRUNCATE TABLE t1;
2020
Warnings:
21-
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.
21+
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.
2222
OPTIMIZE TABLE t1;
2323
Table Op Msg_type Msg_text
2424
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
2525
test.t1 optimize status OK
2626
Warnings:
27-
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.
27+
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.
2828
ALTER TABLE t1 FORCE;
2929
Warnings:
30-
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.
30+
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.
3131
SET innodb_strict_mode = ON;
3232
TRUNCATE TABLE t1;
3333
Warnings:
34-
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.
34+
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.
3535
OPTIMIZE TABLE t1;
3636
Table Op Msg_type Msg_text
3737
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
3838
test.t1 optimize status OK
3939
Warnings:
40-
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.
40+
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.
4141
ALTER TABLE t1 FORCE;
4242
Warnings:
43-
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.
43+
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.
4444
DROP TABLE t1;
4545
SET @@global.log_warnings = 2;
46+
#
47+
# MDEV-20194 Warnings inconsistently issued upon CHECK on
48+
# table from older versions
49+
#
50+
set global innodb_compression_level=1;
51+
CREATE TABLE t1(
52+
f1 INT, f2 CHAR(200), f3 CHAR(200),
53+
f4 CHAR(200), f5 CHAR(200), f6 CHAR(200),
54+
f7 CHAR(200), f8 CHAR(200), f9 CHAR(200),
55+
f10 CHAR(200), PRIMARY KEY(f1, f2(20), f3(20), f4(20))
56+
) ROW_FORMAT=COMPRESSED, ENGINE=InnoDB;
57+
INSERT INTO t1 SELECT seq, repeat('a', 200), repeat('b', 200),
58+
repeat('c', 200), repeat('d', 200),
59+
repeat('d', 200), repeat('e', 200),
60+
repeat('e', 200), repeat('f', 200),
61+
repeat('g', 200) FROM seq_1_to_20;
62+
DROP TABLE t1;
63+
set global innodb_compression_level=default;
64+
CREATE TABLE t1(f1 char(200), f2 char(200), f3 char(200),
65+
f4 char(200), f5 char(200), f6 char(200),
66+
f7 char(200), f8 char(200), f9 char(200),
67+
f10 char(200), f11 char(200), f12 char(200),
68+
f13 char(200), f14 char(200), f15 char(200),
69+
f16 char(200), f17 char(200), f18 char(200),
70+
f19 char(200), f20 char(200), f21 char(200),
71+
f22 char(200), f23 char(200), f24 char(200),
72+
f25 char(200), f26 char(200), f27 char(200),
73+
f28 char(200), f29 char(200), f30 char(200),
74+
f31 char(200), f32 char(200), f33 char(200),
75+
primary key(f1(10), f2(10), f3(10), f4(10),
76+
f5(10), f6(10), f7(10), f8(10),
77+
f9(10), f10(10), f11(10), f12(10),
78+
f13(10), f14(10), f15(10), f16(10),
79+
f17(10), f18(10), f19(10), f20(10),
80+
f21(10), f22(10), f23(10), f24(10),
81+
f25(10), f26(10), f27(10), f28(10),
82+
f29(10), f30(10), f31(10), f32(10),
83+
f33(10)))
84+
ENGINE=InnoDB;
85+
ERROR 42000: Too many key parts specified; max 32 parts allowed

mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
--source include/have_innodb.inc
2+
--source include/have_sequence.inc
3+
--source include/innodb_page_size_small.inc
24

35
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.");
46

57
SET innodb_strict_mode = 0;
68
SET @@global.log_warnings = 3;
79

10+
# Check the Warning | 139 | Row size too large (> 16318)
11+
--replace_regex /> [0-9]+/> NNNN/
812
CREATE TABLE t1 (
913
col_1 TEXT
1014
,col_2 TEXT
@@ -19,14 +23,65 @@ CREATE TABLE t1 (
1923
,col_11 TEXT
2024
) ENGINE=INNODB ROW_FORMAT=COMPACT;
2125
--enable_warnings
26+
--replace_regex /> [0-9]+/> NNNN/
2227
TRUNCATE TABLE t1;
28+
--replace_regex /> [0-9]+/> NNNN/
2329
OPTIMIZE TABLE t1;
30+
--replace_regex /> [0-9]+/> NNNN/
2431
ALTER TABLE t1 FORCE;
2532
SET innodb_strict_mode = ON;
33+
--replace_regex /> [0-9]+/> NNNN/
2634
TRUNCATE TABLE t1;
35+
--replace_regex /> [0-9]+/> NNNN/
2736
OPTIMIZE TABLE t1;
37+
--replace_regex /> [0-9]+/> NNNN/
2838
ALTER TABLE t1 FORCE;
2939
DROP TABLE t1;
3040
--disable_warnings
3141

3242
SET @@global.log_warnings = 2;
43+
44+
--echo #
45+
--echo # MDEV-20194 Warnings inconsistently issued upon CHECK on
46+
--echo # table from older versions
47+
--echo #
48+
set global innodb_compression_level=1;
49+
CREATE TABLE t1(
50+
f1 INT, f2 CHAR(200), f3 CHAR(200),
51+
f4 CHAR(200), f5 CHAR(200), f6 CHAR(200),
52+
f7 CHAR(200), f8 CHAR(200), f9 CHAR(200),
53+
f10 CHAR(200), PRIMARY KEY(f1, f2(20), f3(20), f4(20))
54+
) ROW_FORMAT=COMPRESSED, ENGINE=InnoDB;
55+
56+
INSERT INTO t1 SELECT seq, repeat('a', 200), repeat('b', 200),
57+
repeat('c', 200), repeat('d', 200),
58+
repeat('d', 200), repeat('e', 200),
59+
repeat('e', 200), repeat('f', 200),
60+
repeat('g', 200) FROM seq_1_to_20;
61+
DROP TABLE t1;
62+
set global innodb_compression_level=default;
63+
64+
# Maximum field in the index
65+
66+
--error ER_TOO_MANY_KEY_PARTS
67+
CREATE TABLE t1(f1 char(200), f2 char(200), f3 char(200),
68+
f4 char(200), f5 char(200), f6 char(200),
69+
f7 char(200), f8 char(200), f9 char(200),
70+
f10 char(200), f11 char(200), f12 char(200),
71+
f13 char(200), f14 char(200), f15 char(200),
72+
f16 char(200), f17 char(200), f18 char(200),
73+
f19 char(200), f20 char(200), f21 char(200),
74+
f22 char(200), f23 char(200), f24 char(200),
75+
f25 char(200), f26 char(200), f27 char(200),
76+
f28 char(200), f29 char(200), f30 char(200),
77+
f31 char(200), f32 char(200), f33 char(200),
78+
primary key(f1(10), f2(10), f3(10), f4(10),
79+
f5(10), f6(10), f7(10), f8(10),
80+
f9(10), f10(10), f11(10), f12(10),
81+
f13(10), f14(10), f15(10), f16(10),
82+
f17(10), f18(10), f19(10), f20(10),
83+
f21(10), f22(10), f23(10), f24(10),
84+
f25(10), f26(10), f27(10), f28(10),
85+
f29(10), f30(10), f31(10), f32(10),
86+
f33(10)))
87+
ENGINE=InnoDB;

storage/innobase/handler/ha_innodb.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12641,7 +12641,6 @@ bool create_table_info_t::row_size_is_acceptable(
1264112641
return true;
1264212642
}
1264312643

12644-
/* FIXME: row size check has some flaws and should be improved */
1264512644
dict_index_t::record_size_info_t dict_index_t::record_size_info() const
1264612645
{
1264712646
ut_ad(!(type & DICT_FTS));
@@ -12732,6 +12731,8 @@ dict_index_t::record_size_info_t dict_index_t::record_size_info() const
1273212731
{
1273312732
/* dict_index_add_col() should guarantee this */
1273412733
ut_ad(!f.prefix_len || f.fixed_len == f.prefix_len);
12734+
if (f.prefix_len)
12735+
field_max_size= f.prefix_len;
1273512736
/* Fixed lengths are not encoded
1273612737
in ROW_FORMAT=COMPACT. */
1273712738
goto add_field_size;
@@ -12785,7 +12786,8 @@ dict_index_t::record_size_info_t dict_index_t::record_size_info() const
1278512786
unique columns, result.shortest_size equals the size of the
1278612787
node pointer record minus the node pointer column. */
1278712788
if (i + 1 == dict_index_get_n_unique_in_tree(this) &&
12788-
result.shortest_size + REC_NODE_PTR_SIZE >= page_ptr_max)
12789+
result.shortest_size + REC_NODE_PTR_SIZE + (comp ? 0 : 2) >=
12790+
page_ptr_max)
1278912791
{
1279012792
result.set_too_big(i);
1279112793
}

0 commit comments

Comments
 (0)