Skip to content
Permalink
Browse files

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.
  • Loading branch information...
janlindstrom committed Jul 20, 2017
1 parent f58142f commit d1b3e428d4843b83ef2ea7443ba61a9b7f6bf999
@@ -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;
@@ -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

@@ -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;
@@ -2316,10 +2316,10 @@ btr_cur_optimistic_update(
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;
@@ -2466,10 +2466,10 @@ btr_cur_optimistic_update(
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;

0 comments on commit d1b3e42

Please sign in to comment.
You can’t perform that action at this time.