summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2023-02-10 12:04:50 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2023-02-10 12:05:53 +0530
commitdbbb57a77953104a620b05e554a7eeae515a7891 (patch)
tree37fc3b172c048934f70982d6e8b2a5fb6b47ecd9
parentfa543a0f621fcf19e31c7d044f2b6c4f0836cd5a (diff)
downloadmariadb-git-dbbb57a77953104a620b05e554a7eeae515a7891.tar.gz
MDEV-30426 Assertion !rec_offs_nth_extern(offsets2, n) during bulk insertbb-10.8-MDEV-30426
- cmp_rec_rec_simple() fails to detect duplicate key error for bulk insert operation
-rw-r--r--mysql-test/suite/innodb/r/insert_into_empty.result17
-rw-r--r--mysql-test/suite/innodb/t/insert_into_empty.opt1
-rw-r--r--mysql-test/suite/innodb/t/insert_into_empty.test17
-rw-r--r--storage/innobase/rem/rem0cmp.cc9
4 files changed, 41 insertions, 3 deletions
diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result
index 429e0174f9d..baa02748e2a 100644
--- a/mysql-test/suite/innodb/r/insert_into_empty.result
+++ b/mysql-test/suite/innodb/r/insert_into_empty.result
@@ -404,4 +404,21 @@ SELECT COUNT(*) AS nb_corrupted_rows FROM t1 WHERE data != REPEAT('X', @@innodb_
nb_corrupted_rows
0
DROP TABLE t1;
+#
+# 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.7 tests
diff --git a/mysql-test/suite/innodb/t/insert_into_empty.opt b/mysql-test/suite/innodb/t/insert_into_empty.opt
new file mode 100644
index 00000000000..c856c2d215a
--- /dev/null
+++ b/mysql-test/suite/innodb/t/insert_into_empty.opt
@@ -0,0 +1 @@
+--innodb_sort_buffer_size=65536
diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test
index 64043e383dc..3fbf6f46f22 100644
--- a/mysql-test/suite/innodb/t/insert_into_empty.test
+++ b/mysql-test/suite/innodb/t/insert_into_empty.test
@@ -423,4 +423,21 @@ INSERT INTO t1 VALUES
SELECT COUNT(*) AS nb_corrupted_rows FROM t1 WHERE data != REPEAT('X', @@innodb_sort_buffer_size);
DROP TABLE t1;
+--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.7 tests
diff --git a/storage/innobase/rem/rem0cmp.cc b/storage/innobase/rem/rem0cmp.cc
index a77ddafd568..fe399213575 100644
--- a/storage/innobase/rem/rem0cmp.cc
+++ b/storage/innobase/rem/rem0cmp.cc
@@ -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 && dict_index_is_unique(index)) {
+ if (table) {
+ /* Report erroneous row using new version
+ of table. */
+ innobase_rec_to_mysql(table, rec1, index, offsets1);
+ }
return(0);
}