Skip to content

Commit cbc2812

Browse files
committed
MDEV-35287 ER_KEY_NOT_FOUND upon INSERT into InnoDB table with vector key under READ COMMITTED
InnoDB cannot enable internal bulk insert for hlindex tables
1 parent ad33ffc commit cbc2812

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

mysql-test/main/vector_innodb.result

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,13 @@ drop table t;
186186
#
187187
CREATE TABLE t (pk INT PRIMARY KEY, v VECTOR(5) NOT NULL, VECTOR(v)) ENGINE=InnoDB SELECT 1 AS pk, x'f09baa3ea172763f123def3e0c7fe53e288bf33e' AS v;
188188
DROP TABLE t;
189+
#
190+
# MDEV-35287 ER_KEY_NOT_FOUND upon INSERT into InnoDB table with vector key under READ COMMITTED
191+
#
192+
set unique_checks=0, foreign_key_checks=0;
193+
set session transaction isolation level read committed;
194+
create table t (v vector(1) not null, vector (v)) engine=innodb;
195+
insert into t values (0x31313131),(0x32323232);
196+
drop table t;
197+
set unique_checks=default, foreign_key_checks=default;
198+
set session transaction isolation level repeatable read;

mysql-test/main/vector_innodb.test

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,14 @@ drop table t;
182182
--echo #
183183
CREATE TABLE t (pk INT PRIMARY KEY, v VECTOR(5) NOT NULL, VECTOR(v)) ENGINE=InnoDB SELECT 1 AS pk, x'f09baa3ea172763f123def3e0c7fe53e288bf33e' AS v;
184184
DROP TABLE t;
185+
186+
--echo #
187+
--echo # MDEV-35287 ER_KEY_NOT_FOUND upon INSERT into InnoDB table with vector key under READ COMMITTED
188+
--echo #
189+
set unique_checks=0, foreign_key_checks=0;
190+
set session transaction isolation level read committed;
191+
create table t (v vector(1) not null, vector (v)) engine=innodb;
192+
insert into t values (0x31313131),(0x32323232);
193+
drop table t;
194+
set unique_checks=default, foreign_key_checks=default;
195+
set session transaction isolation level repeatable read;

storage/innobase/handler/ha_innodb.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15948,6 +15948,9 @@ ha_innobase::external_lock(
1594815948
trx_t* trx = m_prebuilt->trx;
1594915949
ut_ad(m_prebuilt->table);
1595015950

15951+
if (table->s->tmp_table == INTERNAL_TMP_TABLE)
15952+
trx->check_unique_secondary = true;
15953+
1595115954
/* Statement based binlogging does not work in isolation level
1595215955
READ UNCOMMITTED and READ COMMITTED since the necessary
1595315956
locks cannot be taken. In this case, we print an

0 commit comments

Comments
 (0)