MDEV-13227: Assertion failure len < 16384 in file rem0rec.cc line 1285

Crashes with innodb_page_size=64K. Does not crash at <= 32K.

Problem was that when blob record that was earlier < 16k is
enlarged at update wo that length > 16K it should be stored
externally. However, that was not enforced when page-size = 64K
(note that 16K+1 < 64K/2 i.e. half of the btree leaf page).

btr_cur_optimistic_update: limit max record size to 16K
or in REDUNDANT row format to 16K-1.
This commit is contained in:
Jan Lindström 2017-07-20 11:24:01 +03:00
parent f58142f644
commit d1b3e428d4
5 changed files with 102 additions and 8 deletions

View file

@ -0,0 +1,38 @@
CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB DEFAULT CHARSET=UTF8 ROW_FORMAT=DYNAMIC;
SHOW WARNINGS;
Level Code Message
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B');
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
UPDATE t1 SET a=CONCAT(a, RAND(), a);
UPDATE t1 SET a=CONCAT(a, RAND(), a);
UPDATE t1 SET a=CONCAT(a, RAND(), a);
SELECT * from t1;
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB DEFAULT CHARSET=UTF8 ROW_FORMAT=REDUNDANT;
SHOW WARNINGS;
Level Code Message
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B');
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
UPDATE t1 SET a=CONCAT(a, RAND(), a);
UPDATE t1 SET a=CONCAT(a, RAND(), a);
UPDATE t1 SET a=CONCAT(a, RAND(), a);
SELECT * from t1;
DROP TABLE t1;

View file

@ -0,0 +1,6 @@
--innodb-file-per-table
--innodb-file-format='Barracuda'
--innodb-buffer-pool-size=32M
--innodb-log-file-size=32M
--innodb-strict-mode=OFF

View file

@ -0,0 +1,50 @@
--source include/have_innodb.inc
--source include/innodb_page_size.inc
#
# MDEV-13227: Assertion failure len < 16384 in file rem0rec.cc line 1285
# Crashes with innodb_page_size=64K. Does not crash at <= 32K.
#
CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB DEFAULT CHARSET=UTF8 ROW_FORMAT=DYNAMIC;
SHOW WARNINGS;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B');
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
UPDATE t1 SET a=CONCAT(a, RAND(), a);
UPDATE t1 SET a=CONCAT(a, RAND(), a);
UPDATE t1 SET a=CONCAT(a, RAND(), a);
# random data no output we are only interested if fails
--disable_result_log
SELECT * from t1;
--enable_result_log
DROP TABLE t1;
CREATE TABLE t1 (a LONGTEXT) ENGINE=INNODB DEFAULT CHARSET=UTF8 ROW_FORMAT=REDUNDANT;
SHOW WARNINGS;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B');
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
INSERT INTO t1 SELECT CONCAT('A', SPACE(4087), 'B') FROM t1;
UPDATE t1 SET a=CONCAT(a, RAND(), a);
UPDATE t1 SET a=CONCAT(a, RAND(), a);
UPDATE t1 SET a=CONCAT(a, RAND(), a);
# random data no output we are only interested if fails
--disable_result_log
SELECT * from t1;
--enable_result_log
DROP TABLE t1;

View file

@ -2316,10 +2316,10 @@ any_extern:
rec = page_cur_get_rec(page_cursor);
}
/* We limit max record size to 16k for 64k page size. */
if (!dict_table_is_comp(index->table)
&& new_rec_size > REDUNDANT_REC_MAX_DATA_SIZE) {
ut_ad(srv_page_size == UNIV_PAGE_SIZE_MAX);
/* We limit max record size to 16k even for 64k page size. */
if (new_rec_size >= COMPRESSED_REC_MAX_DATA_SIZE ||
(!dict_table_is_comp(index->table)
&& new_rec_size >= REDUNDANT_REC_MAX_DATA_SIZE)) {
err = DB_OVERFLOW;
goto func_exit;

View file

@ -2466,10 +2466,10 @@ any_extern:
rec = page_cur_get_rec(page_cursor);
}
/* We limit max record size to 16k for 64k page size. */
if (!dict_table_is_comp(index->table)
&& new_rec_size > REDUNDANT_REC_MAX_DATA_SIZE) {
ut_ad(srv_page_size == UNIV_PAGE_SIZE_MAX);
/* We limit max record size to 16k even for 64k page size. */
if (new_rec_size >= COMPRESSED_REC_MAX_DATA_SIZE ||
(!dict_table_is_comp(index->table)
&& new_rec_size >= REDUNDANT_REC_MAX_DATA_SIZE)) {
err = DB_OVERFLOW;
goto func_exit;