Skip to content

Commit

Permalink
MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n) during bulk in…
Browse files Browse the repository at this point in the history
…sert

- cmp_rec_rec_simple() fails to detect duplicate key error for
bulk insert operation
  • Loading branch information
Thirunarayanan committed Feb 14, 2023
1 parent c7fba94 commit 951d81d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
18 changes: 18 additions & 0 deletions mysql-test/suite/innodb/r/insert_into_empty.result
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,21 @@ nb_corrupted_rows
0
DROP TABLE t1;
# End of 10.7 tests
#
# MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n)
# during bulk insert
#
CREATE TABLE t1(f1 TEXT NOT NULL, f2 TEXT NOT NULL,
f3 TEXT NOT NULL, f4 TEXT NOT NULL,
f5 TEXT NOT NULL, f6 TEXT NOT NULL,
PRIMARY KEY(f6(10)))ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 VALUES
(repeat('a', 200), repeat('b', 200), repeat('c', 200),
repeat('d', 200), repeat('e', 200), repeat('f', 200)),
(repeat('b', 20000), repeat('c', 16000), repeat('d', 12000),
repeat('e', 12000), repeat('f', 12000), repeat('f', 12000));
ERROR HY000: Got error 1 "Operation not permitted" during COMMIT
COMMIT;
DROP TABLE t1;
# End of 10.8 tests
1 change: 1 addition & 0 deletions mysql-test/suite/innodb/t/insert_into_empty.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--innodb_sort_buffer_size=65536
19 changes: 19 additions & 0 deletions mysql-test/suite/innodb/t/insert_into_empty.test
Original file line number Diff line number Diff line change
Expand Up @@ -424,3 +424,22 @@ SELECT COUNT(*) AS nb_corrupted_rows FROM t1 WHERE data != REPEAT('X', @@innodb_
DROP TABLE t1;

--echo # End of 10.7 tests

--echo #
--echo # MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n)
--echo # during bulk insert
--echo #
CREATE TABLE t1(f1 TEXT NOT NULL, f2 TEXT NOT NULL,
f3 TEXT NOT NULL, f4 TEXT NOT NULL,
f5 TEXT NOT NULL, f6 TEXT NOT NULL,
PRIMARY KEY(f6(10)))ENGINE=InnoDB;
BEGIN;
--error ER_ERROR_DURING_COMMIT
INSERT INTO t1 VALUES
(repeat('a', 200), repeat('b', 200), repeat('c', 200),
repeat('d', 200), repeat('e', 200), repeat('f', 200)),
(repeat('b', 20000), repeat('c', 16000), repeat('d', 12000),
repeat('e', 12000), repeat('f', 12000), repeat('f', 12000));
COMMIT;
DROP TABLE t1;
--echo # End of 10.8 tests
9 changes: 6 additions & 3 deletions storage/innobase/rem/rem0cmp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,12 @@ cmp_rec_rec_simple(
/* If we ran out of fields, the ordering columns of rec1 were
equal to rec2. Issue a duplicate key error if needed. */

if (!null_eq && table && dict_index_is_unique(index)) {
/* Report erroneous row using new version of table. */
innobase_rec_to_mysql(table, rec1, index, offsets1);
if (!null_eq && index->is_unique()) {
if (table) {
/* Report erroneous row using new version
of table. */
innobase_rec_to_mysql(table, rec1, index, offsets1);
}
return(0);
}

Expand Down

0 comments on commit 951d81d

Please sign in to comment.