diff --git a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff index 75926282133..c362174e5ba 100644 --- a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff @@ -1,17 +1,6 @@ --- instant_alter.result +++ instant_alter,4k.result -@@ -227,7 +227,9 @@ - COMMIT; - ALTER TABLE t2 ADD COLUMN d1 VARCHAR(2000) DEFAULT REPEAT('asdf',500); - affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 0 -+info: Records: 0 Duplicates: 0 Warnings: 1 -+Warnings: -+Warning 139 Row size too large (> 1979). 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. - SELECT id, c1, ST_AsText(p) p, d1 FROM t2; - id c1 p d1 - 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa LINESTRING(0 0,0 1,1 1) asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd -@@ -241,7 +243,7 @@ +@@ -241,7 +241,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -20,7 +9,7 @@ connection default; ROLLBACK; connection analyze; -@@ -251,7 +253,7 @@ +@@ -251,7 +251,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -29,7 +18,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -262,7 +264,7 @@ +@@ -262,7 +262,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -38,7 +27,7 @@ connection default; ROLLBACK; connection analyze; -@@ -272,7 +274,7 @@ +@@ -272,7 +272,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -47,17 +36,16 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -318,10 +320,14 @@ - ALTER TABLE t3 ADD COLUMN t TEXT CHARSET utf8 - DEFAULT 'The quick brown fox jumps over the lazy dog'; +@@ -320,8 +320,14 @@ affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 0 -+info: Records: 0 Duplicates: 0 Warnings: 1 -+Warnings: -+Warning 139 Row size too large (> 1979). 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. + info: Records: 0 Duplicates: 0 Warnings: 0 ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; ++ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 1979. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs ++SET innodb_strict_mode = OFF; affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 0 ++ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; ++affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 139 Row size too large (> 1979). 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. @@ -83,10 +71,10 @@ +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 139 Row size too large (> 1979). 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 = OFF; - affected rows: 0 SELECT * FROM t3; -@@ -378,6 +388,8 @@ + id c2 c4 c5 c6 c8 phrase b + 1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog +@@ -376,6 +386,8 @@ (id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000), p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; @@ -95,7 +83,7 @@ BEGIN; INSERT INTO big SET id=1, c1=REPEAT('a', 200), c2=REPEAT('b', 200), c3=REPEAT('c', 159); -@@ -395,13 +407,15 @@ +@@ -393,13 +405,15 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -113,7 +101,7 @@ CHECKSUM TABLE big; Table Checksum test.big 1705165209 -@@ -418,7 +432,7 @@ +@@ -416,7 +430,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -122,7 +110,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -431,7 +445,7 @@ +@@ -429,7 +443,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -131,18 +119,7 @@ connection default; InnoDB 0 transactions not purged DROP TABLE t1,t2,t3,t4,big; -@@ -663,7 +677,9 @@ - COMMIT; - ALTER TABLE t2 ADD COLUMN d1 VARCHAR(2000) DEFAULT REPEAT('asdf',500); - affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 0 -+info: Records: 0 Duplicates: 0 Warnings: 1 -+Warnings: -+Warning 139 Row size too large (> 1982). 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. - SELECT id, c1, ST_AsText(p) p, d1 FROM t2; - id c1 p d1 - 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa LINESTRING(0 0,0 1,1 1) asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd -@@ -677,7 +693,7 @@ +@@ -698,7 +712,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -151,7 +128,7 @@ connection default; ROLLBACK; connection analyze; -@@ -687,7 +703,7 @@ +@@ -708,7 +722,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -160,7 +137,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -698,7 +714,7 @@ +@@ -719,7 +733,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -169,7 +146,7 @@ connection default; ROLLBACK; connection analyze; -@@ -708,7 +724,7 @@ +@@ -729,7 +743,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -178,14 +155,8 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -754,10 +770,14 @@ - ALTER TABLE t3 ADD COLUMN t TEXT CHARSET utf8 - DEFAULT 'The quick brown fox jumps over the lazy dog'; - affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 0 -+info: Records: 0 Duplicates: 0 Warnings: 1 -+Warnings: -+Warning 139 Row size too large (> 1982). 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. +@@ -778,7 +792,9 @@ + info: Records: 0 Duplicates: 0 Warnings: 0 ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 0 @@ -195,7 +166,7 @@ INSERT INTO t3 SET id=4; ERROR HY000: Field 'c2' doesn't have a default value INSERT INTO t3 SET id=4, c2=0, b=0xf09f98b1; -@@ -770,7 +790,9 @@ +@@ -791,7 +807,9 @@ ALTER TABLE t3 CHANGE t phrase TEXT DEFAULT 0xc3a4c3a448, CHANGE b b BLOB NOT NULL DEFAULT 'binary line of business'; affected rows: 4 @@ -206,7 +177,7 @@ INSERT INTO t3 SET id=5, c2=9; Warnings: Note 1265 Data truncated for column 'c7' at row 1 -@@ -784,7 +806,9 @@ +@@ -805,7 +823,9 @@ 5 9 POLYGON((1 1,2 2,3 3,1 1)) 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 03:00:42 1970-01-01 ääH binary line of business ALTER TABLE t3 DROP c3, DROP c7; affected rows: 0 @@ -214,10 +185,10 @@ +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 139 Row size too large (> 1982). 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 = OFF; - affected rows: 0 SELECT * FROM t3; -@@ -814,6 +838,8 @@ + id c2 c4 c5 c6 c8 phrase b + 1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog +@@ -833,6 +853,8 @@ (id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000), p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p)) ENGINE=InnoDB ROW_FORMAT=COMPACT; @@ -226,7 +197,7 @@ BEGIN; INSERT INTO big SET id=1, c1=REPEAT('a', 200), c2=REPEAT('b', 200), c3=REPEAT('c', 159); -@@ -831,13 +857,15 @@ +@@ -850,13 +872,15 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -244,7 +215,7 @@ CHECKSUM TABLE big; Table Checksum test.big 1705165209 -@@ -854,7 +882,7 @@ +@@ -873,7 +897,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -253,7 +224,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -867,7 +895,7 @@ +@@ -886,7 +910,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -262,7 +233,7 @@ connection default; InnoDB 0 transactions not purged DROP TABLE t1,t2,t3,t4,big; -@@ -1113,7 +1141,7 @@ +@@ -1155,7 +1179,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -271,7 +242,7 @@ connection default; ROLLBACK; connection analyze; -@@ -1123,7 +1151,7 @@ +@@ -1165,7 +1189,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -280,7 +251,7 @@ connection default; BEGIN; UPDATE t2 SET d1 = repeat(id, 200); -@@ -1134,7 +1162,7 @@ +@@ -1176,7 +1200,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -289,7 +260,7 @@ connection default; ROLLBACK; connection analyze; -@@ -1144,7 +1172,7 @@ +@@ -1186,7 +1210,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t2'; clust_index_size @@ -298,7 +269,7 @@ connection default; ALTER TABLE t2 DROP p; affected rows: 0 -@@ -1267,7 +1295,7 @@ +@@ -1307,7 +1331,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -307,7 +278,7 @@ connection default; ALTER TABLE big ADD COLUMN (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde', -@@ -1290,7 +1318,7 @@ +@@ -1330,7 +1354,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -316,7 +287,7 @@ connection default; ROLLBACK; CHECKSUM TABLE big; -@@ -1303,7 +1331,7 @@ +@@ -1343,7 +1367,7 @@ SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/big'; clust_index_size @@ -325,3 +296,10 @@ connection default; InnoDB 0 transactions not purged DROP TABLE t1,t2,t3,t4,big; +@@ -1431,5 +1455,5 @@ + FROM information_schema.global_status + WHERE variable_name = 'innodb_instant_alter_column'; + instants +-54 ++55 + SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; diff --git a/mysql-test/suite/innodb/r/instant_alter.result b/mysql-test/suite/innodb/r/instant_alter.result index b39e32ce8f4..72f6eee72b8 100644 --- a/mysql-test/suite/innodb/r/instant_alter.result +++ b/mysql-test/suite/innodb/r/instant_alter.result @@ -349,8 +349,6 @@ id c2 c3 c4 c5 c6 c7 c8 phrase b ALTER TABLE t3 DROP c3, DROP c7; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 -SET innodb_strict_mode = OFF; -affected rows: 0 SELECT * FROM t3; id c2 c4 c5 c6 c8 phrase b 1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog @@ -808,8 +806,6 @@ id c2 c3 c4 c5 c6 c7 c8 phrase b ALTER TABLE t3 DROP c3, DROP c7; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 -SET innodb_strict_mode = OFF; -affected rows: 0 SELECT * FROM t3; id c2 c4 c5 c6 c8 phrase b 1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog @@ -1267,8 +1263,6 @@ id c2 c3 c4 c5 c6 c7 c8 phrase b ALTER TABLE t3 DROP c3, DROP c7; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 -SET innodb_strict_mode = OFF; -affected rows: 0 SELECT * FROM t3; id c2 c4 c5 c6 c8 phrase b 1 1 1970-01-01 03:00:42 1970-01-01 03:00:42 NULL 1970-01-01 The quick brown fox jumps over the lazy dog diff --git a/mysql-test/suite/innodb/t/instant_alter.test b/mysql-test/suite/innodb/t/instant_alter.test index 73f052d3e2b..12d8b877d05 100644 --- a/mysql-test/suite/innodb/t/instant_alter.test +++ b/mysql-test/suite/innodb/t/instant_alter.test @@ -46,6 +46,7 @@ SET @old_instant= WHERE variable_name = 'innodb_instant_alter_column'); let $format= 3; +let $redundant_4k= `SELECT @@GLOBAL.innodb_page_size=4096`; while ($format) { let $engine= `SELECT CONCAT('ENGINE=InnoDB ROW_FORMAT=',CASE $format WHEN 1 THEN 'DYNAMIC' @@ -223,6 +224,13 @@ SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6, c7, c8 FROM t3; --enable_info ALTER TABLE t3 ADD COLUMN t TEXT CHARSET utf8 DEFAULT 'The quick brown fox jumps over the lazy dog'; + +if ($redundant_4k) +{ +--error ER_TOO_BIG_ROWSIZE +ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; +SET innodb_strict_mode = OFF; +} ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL; --error ER_NO_DEFAULT_FOR_FIELD INSERT INTO t3 SET id=4; @@ -236,7 +244,6 @@ INSERT INTO t3 SET id=5, c2=9; SELECT id, c2, ST_AsText(c3) c3, c4, c5, c6, c7, c8, phrase, b FROM t3; --enable_info ALTER TABLE t3 DROP c3, DROP c7; -SET innodb_strict_mode = OFF; --disable_info SELECT * FROM t3; @@ -390,6 +397,7 @@ CHECK TABLE t1; DROP TABLE t1; dec $format; +let $redundant_4k= 0; } disconnect analyze; SELECT variable_value-@old_instant instants diff --git a/mysql-test/suite/innodb_zip/r/bug53591.result b/mysql-test/suite/innodb_zip/r/bug53591.result index e14a1942750..0e0a5a05e4b 100644 --- a/mysql-test/suite/innodb_zip/r/bug53591.result +++ b/mysql-test/suite/innodb_zip/r/bug53591.result @@ -1,3 +1,4 @@ +call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is'); SET GLOBAL innodb_file_per_table=on; SET GLOBAL innodb_strict_mode=on; set old_alter_table=0; diff --git a/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result b/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result index f2bbd86e9c8..145f6a8a2e8 100644 --- a/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result +++ b/mysql-test/suite/innodb_zip/r/prefix_index_liftedlimit.result @@ -1,3 +1,4 @@ +call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is'); CREATE TABLE worklog5743 ( col_1_varchar VARCHAR (4000) , col_2_varchar VARCHAR (4000) , PRIMARY KEY (col_1_varchar(3072)) diff --git a/mysql-test/suite/innodb_zip/t/bug53591.test b/mysql-test/suite/innodb_zip/t/bug53591.test index 67223027bad..17c79e0f6f8 100644 --- a/mysql-test/suite/innodb_zip/t/bug53591.test +++ b/mysql-test/suite/innodb_zip/t/bug53591.test @@ -1,5 +1,7 @@ -- source include/innodb_page_size_small.inc +call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is'); + let $file_per_table=`select @@innodb_file_per_table`; SET GLOBAL innodb_file_per_table=on; diff --git a/mysql-test/suite/innodb_zip/t/prefix_index_liftedlimit.test b/mysql-test/suite/innodb_zip/t/prefix_index_liftedlimit.test index bca710386d0..55e69c5fca5 100644 --- a/mysql-test/suite/innodb_zip/t/prefix_index_liftedlimit.test +++ b/mysql-test/suite/innodb_zip/t/prefix_index_liftedlimit.test @@ -15,6 +15,7 @@ --source include/have_innodb.inc --source include/have_innodb_16k.inc +call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is'); # Prefix index with VARCHAR data type , primary/secondary index and DML ops CREATE TABLE worklog5743 ( col_1_varchar VARCHAR (4000) , col_2_varchar VARCHAR (4000) , diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index b6149edaa7a..33d1da382f8 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -1353,9 +1353,8 @@ dict_create_index_step( if (node->state == INDEX_ADD_TO_CACHE) { ut_ad(node->index->table == node->table); - err = dict_index_add_to_cache( - node->index, FIL_NULL, trx_is_strict(trx), - node->add_v); + err = dict_index_add_to_cache(node->index, FIL_NULL, + node->add_v); ut_ad((node->index == NULL) == (err != DB_SUCCESS)); diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 17d2c6c68eb..24dc3890ff9 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -45,11 +45,6 @@ dict_index_t* dict_ind_redundant; extern uint ibuf_debug; #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ -/********************************************************************** -Issue a warning that the row is too big. */ -void -ib_warn_row_too_big(const dict_table_t* table); - #include "btr0btr.h" #include "btr0cur.h" #include "btr0sea.h" @@ -2074,181 +2069,6 @@ dict_col_name_is_reserved( return(FALSE); } -bool dict_index_t::rec_potentially_too_big(bool strict) const -{ - ut_ad(table); - - ulint comp; - ulint i; - /* maximum possible storage size of a record */ - ulint rec_max_size; - /* maximum allowed size of a record on a leaf page */ - ulint page_rec_max; - /* maximum allowed size of a node pointer record */ - ulint page_ptr_max; - - /* FTS index consists of auxiliary tables, they shall be excluded from - index row size check */ - if (type & DICT_FTS) { - return false; - } - - DBUG_EXECUTE_IF( - "ib_force_create_table", - return(FALSE);); - - comp = dict_table_is_comp(table); - - const page_size_t page_size(dict_tf_get_page_size(table->flags)); - - if (page_size.is_compressed() - && page_size.physical() < srv_page_size) { - /* On a compressed page, two records must fit in the - uncompressed page modification log. On compressed pages - with size.physical() == srv_page_size, - this limit will never be reached. */ - ut_ad(comp); - /* The maximum allowed record size is the size of - an empty page, minus a byte for recoding the heap - number in the page modification log. The maximum - allowed node pointer size is half that. */ - page_rec_max = page_zip_empty_size(n_fields, - page_size.physical()); - if (page_rec_max) { - page_rec_max--; - } - page_ptr_max = page_rec_max / 2; - /* On a compressed page, there is a two-byte entry in - the dense page directory for every record. But there - is no record header. */ - rec_max_size = 2; - } else { - /* The maximum allowed record size is half a B-tree - page(16k for 64k page size). No additional sparse - page directory entry will be generated for the first - few user records. */ - page_rec_max = (comp || srv_page_size < UNIV_PAGE_SIZE_MAX) - ? page_get_free_space_of_empty(comp) / 2 - : REDUNDANT_REC_MAX_DATA_SIZE; - - page_ptr_max = page_rec_max; - /* Each record has a header. */ - rec_max_size = comp - ? REC_N_NEW_EXTRA_BYTES - : REC_N_OLD_EXTRA_BYTES; - } - - if (comp) { - /* Include the "null" flags in the - maximum possible record size. */ - rec_max_size += UT_BITS_IN_BYTES(unsigned(n_nullable)); - } else { - /* For each column, include a 2-byte offset and a - "null" flag. The 1-byte format is only used in short - records that do not contain externally stored columns. - Such records could never exceed the page limit, even - when using the 2-byte format. */ - rec_max_size += 2 * unsigned(n_fields); - } - - const ulint max_local_len = table->get_overflow_field_local_len(); - - /* Compute the maximum possible record size. */ - for (i = 0; i < n_fields; i++) { - const dict_field_t* field - = dict_index_get_nth_field(this, i); - const dict_col_t* col - = dict_field_get_col(field); - - /* In dtuple_convert_big_rec(), variable-length columns - that are longer than BTR_EXTERN_LOCAL_STORED_MAX_SIZE - may be chosen for external storage. - - Fixed-length columns, and all columns of secondary - index records are always stored inline. */ - - /* Determine the maximum length of the index field. - The field_ext_max_size should be computed as the worst - case in rec_get_converted_size_comp() for - REC_STATUS_ORDINARY records. */ - - size_t field_max_size = dict_col_get_fixed_size(col, comp); - if (field_max_size && field->fixed_len != 0) { - /* dict_index_add_col() should guarantee this */ - ut_ad(!field->prefix_len - || field->fixed_len == field->prefix_len); - /* Fixed lengths are not encoded - in ROW_FORMAT=COMPACT. */ - goto add_field_size; - } - - field_max_size = dict_col_get_max_size(col); - - if (field->prefix_len) { - if (field->prefix_len < field_max_size) { - field_max_size = field->prefix_len; - } - - // those conditions were copied from dtuple_convert_big_rec() - } else if (field_max_size > max_local_len - && field_max_size > BTR_EXTERN_LOCAL_STORED_MAX_SIZE - && DATA_BIG_COL(col) - && dict_index_is_clust(this)) { - - /* In the worst case, we have a locally stored - column of BTR_EXTERN_LOCAL_STORED_MAX_SIZE bytes. - The length can be stored in one byte. If the - column were stored externally, the lengths in - the clustered index page would be - BTR_EXTERN_FIELD_REF_SIZE and 2. */ - field_max_size = max_local_len; - } - - if (comp) { - /* Add the extra size for ROW_FORMAT=COMPACT. - For ROW_FORMAT=REDUNDANT, these bytes were - added to rec_max_size before this loop. */ - rec_max_size += field_max_size < 256 ? 1 : 2; - } -add_field_size: - rec_max_size += field_max_size; - - /* Check the size limit on leaf pages. */ - if (rec_max_size >= page_rec_max) { - // with 4k page size innodb_index_stats becomes too big - // this crutch allows server bootstrapping to continue - if (table->is_system_db) { - return false; - } - - ib::error_or_warn(strict) - << "Cannot add field " << field->name - << " in table " << table->name - << " because after adding it, the row size is " - << rec_max_size - << " which is greater than maximum allowed" - " size (" << page_rec_max - << ") for a record on index leaf page."; - - return true; - } - - /* Check the size limit on non-leaf pages. Records - stored in non-leaf B-tree pages consist of the unique - columns of the record (the key columns of the B-tree) - and a node pointer field. When we have processed the - unique columns, rec_max_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) - && rec_max_size + REC_NODE_PTR_SIZE >= page_ptr_max) { - - return true; - } - } - - return false; -} - /** Clears the virtual column's index list before index is being freed. @param[in] index Index being freed */ @@ -2292,16 +2112,12 @@ added column. @param[in,out] index index; NOTE! The index memory object is freed in this function! @param[in] page_no root page number of the index -@param[in] strict true=refuse to create the index - if records could be too big to fit in - an B-tree page @param[in] add_v virtual columns being added along with ADD INDEX -@return DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION */ +@return DB_SUCCESS, or DB_CORRUPTION */ dberr_t dict_index_add_to_cache( dict_index_t*& index, ulint page_no, - bool strict, const dict_add_v_col_t* add_v) { dict_index_t* new_index; @@ -2350,20 +2166,6 @@ dict_index_add_to_cache( new_index->disable_ahi = index->disable_ahi; #endif - if (new_index->rec_potentially_too_big(strict)) { - - if (strict) { - dict_mem_index_free(new_index); - dict_mem_index_free(index); - index = NULL; - return DB_TOO_BIG_RECORD; - } else if (current_thd != NULL) { - /* Avoid the warning to be printed - during recovery. */ - ib_warn_row_too_big(index->table); - } - } - n_ord = new_index->n_uniq; /* Flag the ordering columns and also set column max_prefix */ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ffa8bea1850..29f29544f29 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5454,7 +5454,7 @@ normalize_table_name_c_low( create_table_info_t::create_table_info_t( THD* thd, - TABLE* form, + const TABLE* form, HA_CREATE_INFO* create_info, char* table_name, char* remote_path, @@ -12493,9 +12493,243 @@ int create_table_info_t::create_table(bool create_fk) } } + if (!row_size_is_acceptable(*m_table)) { + DBUG_RETURN(convert_error_code_to_mysql( + DB_TOO_BIG_RECORD, m_flags, NULL)); + } + DBUG_RETURN(0); } +bool create_table_info_t::row_size_is_acceptable( + const dict_table_t &table) const +{ + for (dict_index_t *index= dict_table_get_first_index(&table); index; + index= dict_table_get_next_index(index)) + { + + if (!row_size_is_acceptable(*index)) + { + return false; + } + } + + 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)); + + /* maximum allowed size of a node pointer record */ + ulint page_ptr_max; + const bool comp= dict_table_is_comp(table); + /* table->space == NULL after DISCARD TABLESPACE */ + const page_size_t page_size(dict_tf_get_page_size(table->flags)); + record_size_info_t result; + + if (page_size.is_compressed() && + page_size.physical() < univ_page_size.physical()) + { + /* On a ROW_FORMAT=COMPRESSED page, two records must fit in the + uncompressed page modification log. On compressed pages + with size.physical() == univ_page_size.physical(), + this limit will never be reached. */ + ut_ad(comp); + /* The maximum allowed record size is the size of + an empty page, minus a byte for recoding the heap + number in the page modification log. The maximum + allowed node pointer size is half that. */ + result.max_leaf_size= page_zip_empty_size(n_fields, page_size.physical()); + if (result.max_leaf_size) + { + result.max_leaf_size--; + } + page_ptr_max= result.max_leaf_size / 2; + /* On a compressed page, there is a two-byte entry in + the dense page directory for every record. But there + is no record header. */ + result.shortest_size= 2; + } + else + { + /* The maximum allowed record size is half a B-tree + page(16k for 64k page size). No additional sparse + page directory entry will be generated for the first + few user records. */ + result.max_leaf_size= (comp || srv_page_size < UNIV_PAGE_SIZE_MAX) + ? page_get_free_space_of_empty(comp) / 2 + : REDUNDANT_REC_MAX_DATA_SIZE; + + page_ptr_max= result.max_leaf_size; + /* Each record has a header. */ + result.shortest_size= comp ? REC_N_NEW_EXTRA_BYTES : REC_N_OLD_EXTRA_BYTES; + } + + if (comp) + { + /* Include the "null" flags in the + maximum possible record size. */ + result.shortest_size+= UT_BITS_IN_BYTES(n_nullable); + } + else + { + /* For each column, include a 2-byte offset and a + "null" flag. The 1-byte format is only used in short + records that do not contain externally stored columns. + Such records could never exceed the page limit, even + when using the 2-byte format. */ + result.shortest_size+= 2 * n_fields; + } + + const ulint max_local_len= table->get_overflow_field_local_len(); + + /* Compute the maximum possible record size. */ + for (unsigned i= 0; i < n_fields; i++) + { + const dict_field_t &f= fields[i]; + const dict_col_t &col= *f.col; + + /* In dtuple_convert_big_rec(), variable-length columns + that are longer than BTR_EXTERN_LOCAL_STORED_MAX_SIZE + may be chosen for external storage. + + Fixed-length columns, and all columns of secondary + index records are always stored inline. */ + + /* Determine the maximum length of the index field. + The field_ext_max_size should be computed as the worst + case in rec_get_converted_size_comp() for + REC_STATUS_ORDINARY records. */ + + size_t field_max_size= dict_col_get_fixed_size(&col, comp); + if (field_max_size && f.fixed_len != 0) + { + /* dict_index_add_col() should guarantee this */ + ut_ad(!f.prefix_len || f.fixed_len == f.prefix_len); + /* Fixed lengths are not encoded + in ROW_FORMAT=COMPACT. */ + goto add_field_size; + } + + field_max_size= dict_col_get_max_size(&col); + + if (f.prefix_len) + { + if (f.prefix_len < field_max_size) + { + field_max_size= f.prefix_len; + } + + /* those conditions were copied from dtuple_convert_big_rec()*/ + } + else if (field_max_size > max_local_len && + field_max_size > BTR_EXTERN_LOCAL_STORED_MAX_SIZE && + DATA_BIG_COL(&col) && dict_index_is_clust(this)) + { + + /* In the worst case, we have a locally stored + column of BTR_EXTERN_LOCAL_STORED_MAX_SIZE bytes. + The length can be stored in one byte. If the + column were stored externally, the lengths in + the clustered index page would be + BTR_EXTERN_FIELD_REF_SIZE and 2. */ + field_max_size= max_local_len; + } + + if (comp) + { + /* Add the extra size for ROW_FORMAT=COMPACT. + For ROW_FORMAT=REDUNDANT, these bytes were + added to result.shortest_size before this loop. */ + result.shortest_size+= field_max_size < 256 ? 1 : 2; + } + add_field_size: + result.shortest_size+= field_max_size; + + /* Check the size limit on leaf pages. */ + if (result.shortest_size >= result.max_leaf_size) + { + result.set_too_big(i); + } + + /* Check the size limit on non-leaf pages. Records + stored in non-leaf B-tree pages consist of the unique + columns of the record (the key columns of the B-tree) + and a node pointer field. When we have processed the + 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.set_too_big(i); + } + } + + return result; +} + +/** Issue a warning that the row is too big. */ +static void ib_warn_row_too_big(THD *thd, const dict_table_t *table) +{ + /* FIXME: this row size check should be improved */ + /* If prefix is true then a 768-byte prefix is stored + locally for BLOB fields. Refer to dict_table_get_format() */ + const bool prefix= !dict_table_has_atomic_blobs(table); + + const ulint free_space= + page_get_free_space_of_empty(table->flags & DICT_TF_COMPACT) / 2; + + push_warning_printf( + thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_TO_BIG_ROW, + "Row size too large (> " ULINTPF "). Changing some columns to TEXT" + " or BLOB %smay help. In current row format, BLOB prefix of" + " %d bytes is stored inline.", + free_space, + prefix ? "or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED " : "", + prefix ? DICT_MAX_FIXED_COL_LEN : 0); +} + +bool create_table_info_t::row_size_is_acceptable( + const dict_index_t &index) const +{ + if ((index.type & DICT_FTS) || index.table->is_system_db) + { + /* Ignore system tables check because innodb_table_stats + maximum row size can not fit on 4k page. */ + return true; + } + + const bool strict= THDVAR(m_thd, strict_mode); + dict_index_t::record_size_info_t info= index.record_size_info(); + + if (info.row_is_too_big()) + { + ut_ad(info.get_overrun_size() != 0); + ut_ad(info.max_leaf_size != 0); + + const size_t idx= info.get_first_overrun_field_index(); + const dict_field_t *field= dict_index_get_nth_field(&index, idx); + + ib::error_or_warn(strict) + << "Cannot add field " << field->name << " in table " + << index.table->name << " because after adding it, the row size is " + << info.get_overrun_size() + << " which is greater than maximum allowed size (" + << info.max_leaf_size << " bytes) for a record on index leaf page."; + + if (strict) + { + return false; + } + + ib_warn_row_too_big(m_thd, index.table); + } + + return true; +} + /** Update a new table in an InnoDB database. @return error number */ int @@ -21259,31 +21493,6 @@ innobase_convert_to_system_charset( cs2, to, static_cast(len), errors))); } -/********************************************************************** -Issue a warning that the row is too big. */ -void -ib_warn_row_too_big(const dict_table_t* table) -{ - /* If prefix is true then a 768-byte prefix is stored - locally for BLOB fields. */ - const bool prefix = !dict_table_has_atomic_blobs(table); - - const ulint free_space = page_get_free_space_of_empty( - table->flags & DICT_TF_COMPACT) / 2; - - THD* thd = current_thd; - - push_warning_printf( - thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_TO_BIG_ROW, - "Row size too large (> " ULINTPF ")." - " Changing some columns to TEXT" - " or BLOB %smay help. In current row format, BLOB prefix of" - " %d bytes is stored inline.", free_space - , prefix ? "or using ROW_FORMAT=DYNAMIC or" - " ROW_FORMAT=COMPRESSED ": "" - , prefix ? DICT_MAX_FIXED_COL_LEN : 0); -} - /** Validate the requested buffer pool size. Also, reserve the necessary memory needed for buffer pool resize. @param[in] thd thread handle diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 81e563012de..d4390374cd2 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -641,7 +641,7 @@ public: - all but name/path is used, when validating options and using flags. */ create_table_info_t( THD* thd, - TABLE* form, + const TABLE* form, HA_CREATE_INFO* create_info, char* table_name, char* remote_path, @@ -689,6 +689,11 @@ public: void allocate_trx(); + /** Checks that every index have sane size. Depends on strict mode */ + bool row_size_is_acceptable(const dict_table_t& table) const; + /** Checks that given index have sane size. Depends on strict mode */ + bool row_size_is_acceptable(const dict_index_t& index) const; + /** Determines InnoDB table flags. If strict_mode=OFF, this will adjust the flags to what should be assumed. @retval true if successful, false if error */ diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 567285b0a68..bd1bd8fbb9c 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -4921,6 +4921,10 @@ prepare_inplace_alter_table_dict( new_clustered = (DICT_CLUSTERED & index_defs[0].ind_type) != 0; + create_table_info_t info(ctx->prebuilt->trx->mysql_thd, altered_table, + ha_alter_info->create_info, NULL, NULL, + srv_file_per_table); + /* The primary index would be rebuilt if a FTS Doc ID column is to be added, and the primary index definition is just copied from old table and stored in indexdefs[0] */ @@ -5300,7 +5304,7 @@ new_clustered_failed: for (uint a = 0; a < ctx->num_to_add_index; a++) { ctx->add_index[a]->table = ctx->new_table; error = dict_index_add_to_cache( - ctx->add_index[a], FIL_NULL, false, add_v); + ctx->add_index[a], FIL_NULL, add_v); ut_a(error == DB_SUCCESS); } DBUG_ASSERT(ha_alter_info->key_count @@ -5539,6 +5543,10 @@ new_table_failed: } ctx->add_index[a] = index; + if (!info.row_size_is_acceptable(*index)) { + error = DB_TOO_BIG_RECORD; + goto error_handling; + } index->parser = index_defs[a].parser; index->has_new_v_col = has_new_v_col; /* Note the id of the transaction that created this @@ -5637,6 +5645,10 @@ error_handling_drop_uncached: DBUG_ASSERT(index != ctx->add_index[a]); } ctx->add_index[a]= index; + if (!info.row_size_is_acceptable(*index)) { + error = DB_TOO_BIG_RECORD; + goto error_handling_drop_uncached; + } index->parser = index_defs[a].parser; index->has_new_v_col = has_new_v_col; @@ -5685,6 +5697,10 @@ error_handling_drop_uncached: } } } + } else if (ctx->is_instant() + && !info.row_size_is_acceptable(*user_table)) { + error = DB_TOO_BIG_RECORD; + goto error_handling; } if (ctx->online && ctx->num_to_add_index) { diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index a015c176a78..9f5485bb15c 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -1070,16 +1070,12 @@ added column. @param[in,out] index index; NOTE! The index memory object is freed in this function! @param[in] page_no root page number of the index -@param[in] strict true=refuse to create the index - if records could be too big to fit in - an B-tree page @param[in] add_v virtual columns being added along with ADD INDEX -@return DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION */ +@return DB_SUCCESS, or DB_CORRUPTION */ dberr_t dict_index_add_to_cache( dict_index_t*& index, ulint page_no, - bool strict = false, const dict_add_v_col_t* add_v = NULL) MY_ATTRIBUTE((warn_unused_result)); /********************************************************************//** diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 093e8cac4b2..df114b305c3 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1121,11 +1121,65 @@ struct dict_index_t{ bool vers_history_row(const rec_t* rec, bool &history_row); - /** If a record of this index might not fit on a single B-tree page, - return true. - @param[in] strict issue error or warning - @return true if the index record could become too big */ - bool rec_potentially_too_big(bool strict) const; + /** This ad-hoc class is used by record_size_info only. */ + class record_size_info_t { + public: + record_size_info_t() + : max_leaf_size(0), shortest_size(0), too_big(false), + first_overrun_field_index(SIZE_T_MAX), overrun_size(0) + { + } + + /** Mark row potentially too big for page and set up first + overflow field index. */ + void set_too_big(size_t field_index) + { + ut_ad(field_index != SIZE_T_MAX); + + too_big = true; + if (first_overrun_field_index > field_index) { + first_overrun_field_index = field_index; + overrun_size = shortest_size; + } + } + + /** @return overrun field index or SIZE_T_MAX if nothing + overflowed*/ + size_t get_first_overrun_field_index() const + { + ut_ad(row_is_too_big()); + ut_ad(first_overrun_field_index != SIZE_T_MAX); + return first_overrun_field_index; + } + + size_t get_overrun_size() const + { + ut_ad(row_is_too_big()); + return overrun_size; + } + + bool row_is_too_big() const { return too_big; } + + size_t max_leaf_size; /** Bigger row size this index can + produce */ + size_t shortest_size; /** shortest because it counts everything + as in overflow pages */ + + private: + bool too_big; /** This one is true when maximum row size this + index can produce is bigger than maximum row + size given page can hold. */ + size_t first_overrun_field_index; /** After adding this field + index row overflowed maximum + allowed size. Useful for + reporting back to user. */ + size_t overrun_size; /** Just overrun row size */ + }; + + /** Returns max possibly record size for that index, size of a shortest + everything in overflow) size of the longest possible row and index + of a field which made index records too big to fit on a page.*/ + inline record_size_info_t record_size_info() const; }; /** Detach a column from an index. diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.ic index a03a94d0bc1..90c6ee29657 100644 --- a/storage/innobase/include/page0zip.ic +++ b/storage/innobase/include/page0zip.ic @@ -164,6 +164,9 @@ page_zip_rec_needs_ext( ulint n_fields, const page_size_t& page_size) { + /* FIXME: row size check is this function seems to be the most correct. + Put it in a separate function and use in more places of InnoDB */ + ut_ad(rec_size > ulint(comp ? REC_N_NEW_EXTRA_BYTES : REC_N_OLD_EXTRA_BYTES)); ut_ad(comp || !page_size.is_compressed()); diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 7bf2655c196..fbd37216ed4 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -2580,8 +2580,7 @@ row_create_index_for_mysql( } else { dict_build_index_def(table, index, trx); - err = dict_index_add_to_cache( - index, FIL_NULL, trx_is_strict(trx)); + err = dict_index_add_to_cache(index, FIL_NULL); ut_ad((index == NULL) == (err != DB_SUCCESS)); if (UNIV_LIKELY(err == DB_SUCCESS)) { ut_ad(!index->is_instant());