From 883fb66cd471859c986585e978a6af175096c0a9 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 23 Oct 2024 23:04:56 +0400 Subject: [PATCH] MDEV-35130 Assertion fails in trx_t::check_bulk_buffer upon CREATE.. SELECT with vector key Similarly to "ALTER TABLE fixes for high-level indexes", don't enable bulk insert when issuing create ... insert into a table containing vector index. InnoDB can't handle situation when bulk insert is enabled for one table but disabled for another. We can't do bulk insert on vector index as it does table updates currently. --- mysql-test/main/vector_innodb.result | 5 +++++ mysql-test/main/vector_innodb.test | 6 ++++++ sql/sql_insert.cc | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/vector_innodb.result b/mysql-test/main/vector_innodb.result index 27a972b3638..f14840f5f5c 100644 --- a/mysql-test/main/vector_innodb.result +++ b/mysql-test/main/vector_innodb.result @@ -181,3 +181,8 @@ create table t (v vector(1), key(v)) engine=innodb; select v from t where v = vec_fromtext('[1]'); v drop table t; +# +# MDEV-35130 Assertion fails in trx_t::check_bulk_buffer upon CREATE.. SELECT with vector key +# +CREATE TABLE t (pk INT PRIMARY KEY, v VECTOR(5) NOT NULL, VECTOR(v)) ENGINE=InnoDB SELECT 1 AS pk, x'f09baa3ea172763f123def3e0c7fe53e288bf33e' AS v; +DROP TABLE t; diff --git a/mysql-test/main/vector_innodb.test b/mysql-test/main/vector_innodb.test index 5bcd828116a..e93ed30eb34 100644 --- a/mysql-test/main/vector_innodb.test +++ b/mysql-test/main/vector_innodb.test @@ -176,3 +176,9 @@ drop table t; create table t (v vector(1), key(v)) engine=innodb; select v from t where v = vec_fromtext('[1]'); drop table t; + +--echo # +--echo # MDEV-35130 Assertion fails in trx_t::check_bulk_buffer upon CREATE.. SELECT with vector key +--echo # +CREATE TABLE t (pk INT PRIMARY KEY, v VECTOR(5) NOT NULL, VECTOR(v)) ENGINE=InnoDB SELECT 1 AS pk, x'f09baa3ea172763f123def3e0c7fe53e288bf33e' AS v; +DROP TABLE t; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 9d2da78218c..4ed482dd92d 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -4998,7 +4998,7 @@ select_create::prepare(List &_values, SELECT_LEX_UNIT *u) if (info.handle_duplicates == DUP_UPDATE) table->file->extra(HA_EXTRA_INSERT_WITH_UPDATE); if (thd->locked_tables_mode <= LTM_LOCK_TABLES && - !table->s->long_unique_table) + !table->s->long_unique_table && !table->s->hlindexes()) { table->file->ha_start_bulk_insert((ha_rows) 0); if (thd->lex->duplicates == DUP_ERROR && !thd->lex->ignore)