Skip to content

Commit 951d81d

Browse files
MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n) during bulk insert
- cmp_rec_rec_simple() fails to detect duplicate key error for bulk insert operation
1 parent c7fba94 commit 951d81d

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,3 +405,21 @@ nb_corrupted_rows
405405
0
406406
DROP TABLE t1;
407407
# End of 10.7 tests
408+
#
409+
# MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n)
410+
# during bulk insert
411+
#
412+
CREATE TABLE t1(f1 TEXT NOT NULL, f2 TEXT NOT NULL,
413+
f3 TEXT NOT NULL, f4 TEXT NOT NULL,
414+
f5 TEXT NOT NULL, f6 TEXT NOT NULL,
415+
PRIMARY KEY(f6(10)))ENGINE=InnoDB;
416+
BEGIN;
417+
INSERT INTO t1 VALUES
418+
(repeat('a', 200), repeat('b', 200), repeat('c', 200),
419+
repeat('d', 200), repeat('e', 200), repeat('f', 200)),
420+
(repeat('b', 20000), repeat('c', 16000), repeat('d', 12000),
421+
repeat('e', 12000), repeat('f', 12000), repeat('f', 12000));
422+
ERROR HY000: Got error 1 "Operation not permitted" during COMMIT
423+
COMMIT;
424+
DROP TABLE t1;
425+
# End of 10.8 tests
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--innodb_sort_buffer_size=65536

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,3 +424,22 @@ SELECT COUNT(*) AS nb_corrupted_rows FROM t1 WHERE data != REPEAT('X', @@innodb_
424424
DROP TABLE t1;
425425

426426
--echo # End of 10.7 tests
427+
428+
--echo #
429+
--echo # MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n)
430+
--echo # during bulk insert
431+
--echo #
432+
CREATE TABLE t1(f1 TEXT NOT NULL, f2 TEXT NOT NULL,
433+
f3 TEXT NOT NULL, f4 TEXT NOT NULL,
434+
f5 TEXT NOT NULL, f6 TEXT NOT NULL,
435+
PRIMARY KEY(f6(10)))ENGINE=InnoDB;
436+
BEGIN;
437+
--error ER_ERROR_DURING_COMMIT
438+
INSERT INTO t1 VALUES
439+
(repeat('a', 200), repeat('b', 200), repeat('c', 200),
440+
repeat('d', 200), repeat('e', 200), repeat('f', 200)),
441+
(repeat('b', 20000), repeat('c', 16000), repeat('d', 12000),
442+
repeat('e', 12000), repeat('f', 12000), repeat('f', 12000));
443+
COMMIT;
444+
DROP TABLE t1;
445+
--echo # End of 10.8 tests

storage/innobase/rem/rem0cmp.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,9 +725,12 @@ cmp_rec_rec_simple(
725725
/* If we ran out of fields, the ordering columns of rec1 were
726726
equal to rec2. Issue a duplicate key error if needed. */
727727

728-
if (!null_eq && table && dict_index_is_unique(index)) {
729-
/* Report erroneous row using new version of table. */
730-
innobase_rec_to_mysql(table, rec1, index, offsets1);
728+
if (!null_eq && index->is_unique()) {
729+
if (table) {
730+
/* Report erroneous row using new version
731+
of table. */
732+
innobase_rec_to_mysql(table, rec1, index, offsets1);
733+
}
731734
return(0);
732735
}
733736

0 commit comments

Comments
 (0)