1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' failed in cmp_rec_rec_simple_field

Problem:
=======
InnoDB wrongly stores the primary key field in externally
stored off page during bulk insert operation. This leads
to assert failure.

Solution:
========
row_merge_buf_blob(): Should store the primary key fields
inline. Store the variable length field data externally
based on the row format of the table.

row_merge_buf_write(): check whether the record size exceeds
the maximum record size.

row_merge_copy_blob_from_file(): Construct the tuple based on
the variable length field
This commit is contained in:
Thirunarayanan Balathandayuthapani
2024-12-09 16:54:31 +05:30
parent 1a557d087c
commit b9e592a786
14 changed files with 443 additions and 74 deletions

View File

@@ -83,4 +83,29 @@ CREATE TABLE t engine=innodb
SELECT t2.f2 FROM t2 JOIN t1 ON t1.f1 = t2.f1 AND t1.f3 = '' AND t1.f2=1 ;
SELECT COUNT(*) FROM t;
DROP TABLE t1, t2, t;
--echo #
--echo # MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)'
--echo # failed in cmp_rec_rec_simple_field
--echo #
CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'),
(REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'),
(REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'),
(REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)),
(REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'),
(REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'),
(REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'),
(REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'),
(REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'),
(REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'),
(REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'),
(REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'),
(REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'),
(REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'),
(REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'),
(REPEAT('x',65535),'dd');
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
DROP TABLE t1;
SET GLOBAL innodb_stats_persistent=@default_stats_persistent;

View File

@@ -0,0 +1 @@
--innodb_sort_buffer_size=65536

View File

@@ -2,6 +2,7 @@
--source include/have_innodb_64k.inc
# Embedded server does not support restarting
--source include/not_embedded.inc
--source innodb_default_row_format.inc
let $MYSQLD_DATADIR= `select @@datadir`;
@@ -314,3 +315,64 @@ connection default;
check table t1,t2;
drop table t1,t2;
--echo #
--echo # MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)'
--echo # failed in cmp_rec_rec_simple_field
--echo #
let $row_format= `select @@global.innodb_default_row_format`;
if ($row_format != "redundant")
{
CREATE TABLE t1(f1 int not null, f2 text, f3 text, f4 text,
f5 text, f6 text, f7 text, f8 text,
f9 text, f10 text, f11 text, f12 text,
f13 text, f14 text, f15 text, f16 text,
f17 text, f18 text, f19 text, f20 text,
f21 text, f22 text, f23 text, f24 text,
f25 text, PRIMARY KEY(f1))ENGINE=InnoDB;
let $error_code = ER_TOO_BIG_ROWSIZE;
if ($row_format == "dynamic")
{
let $error_code = 0;
}
--error $error_code
SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR
INSERT INTO t1 VALUES(1, REPEAT('a', 1024), REPEAT('b', 1024),
REPEAT('c', 1024), REPEAT('d', 1024),
REPEAT('e', 1024), REPEAT('f', 1024),
REPEAT('g', 4096), REPEAT('h', 1024),
REPEAT('i', 1024), REPEAT('j', 1024),
REPEAT('k', 1024), REPEAT('l', 1024),
REPEAT('m', 1024), REPEAT('n', 1024),
REPEAT('o', 1024), REPEAT('p', 1024),
REPEAT('q', 1024), REPEAT('r', 1024),
REPEAT('s', 1024), REPEAT('t', 1024),
REPEAT('u', 1024), REPEAT('v', 1024),
REPEAT('w', 1024), REPEAT('x', 1024)),
(2, REPEAT('a', 1024), REPEAT('b', 1024),
REPEAT('c', 1024), REPEAT('d', 1024),
REPEAT('e', 1024), REPEAT('f', 1024),
REPEAT('g', 4096), REPEAT('h', 1024),
REPEAT('i', 1024), REPEAT('j', 1024),
REPEAT('k', 1024), REPEAT('l', 1024),
REPEAT('m', 1024), REPEAT('n', 1024),
REPEAT('o', 1024), REPEAT('p', 1024),
REPEAT('q', 1024), REPEAT('r', 1024),
REPEAT('s', 1024), REPEAT('t', 1024),
REPEAT('u', 1024), REPEAT('v', 1024),
REPEAT('w', 1024), REPEAT('x', 1024)),
(3, REPEAT('a', 1024), REPEAT('b', 1024),
REPEAT('c', 1024), REPEAT('d', 1024),
REPEAT('e', 1024), REPEAT('f', 1024),
REPEAT('g', 4096), REPEAT('h', 1024),
REPEAT('i', 1024), REPEAT('j', 1024),
REPEAT('k', 1024), REPEAT('l', 1024),
REPEAT('m', 1024), REPEAT('n', 1024),
REPEAT('o', 1024), REPEAT('p', 1024),
REPEAT('q', 1024), REPEAT('r', 1024),
REPEAT('s', 1024), REPEAT('t', 1024),
REPEAT('u', 1024), REPEAT('v', 1024),
REPEAT('w', 1024), REPEAT('x', 1024));
DROP TABLE t1;
}

View File

@@ -484,7 +484,7 @@ ALTER TABLE t1 FORCE;
let $page_size= `SELECT @@innodb_page_size`;
let $error_code = 0;
if ($page_size == 4096) {
if ($page_size <= 16384) {
let $error_code = ER_TOO_BIG_ROWSIZE;
}
@@ -593,4 +593,30 @@ INSERT INTO t1 VALUES(2,0);
DELETE FROM t1;
commit;
DROP TABLE t1;
if ($page_size >= 16384) {
--echo #
--echo # MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)'
--echo # failed in cmp_rec_rec_simple_field
--echo #
CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'),
(REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'),
(REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'),
(REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)),
(REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'),
(REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'),
(REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'),
(REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'),
(REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'),
(REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'),
(REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'),
(REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'),
(REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'),
(REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'),
(REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'),
(REPEAT('x',65535),'dd');
DROP TABLE t1;
}
--echo # End of 10.11 tests