diff --git a/mysql-test/suite/binlog/r/binlog_innodb_stm.result b/mysql-test/suite/binlog/r/binlog_innodb_stm.result index 829ed7d3c61c4..4a7702a1685da 100644 --- a/mysql-test/suite/binlog/r/binlog_innodb_stm.result +++ b/mysql-test/suite/binlog/r/binlog_innodb_stm.result @@ -15,3 +15,12 @@ on update cascade insert into categories values (1, 'drinks', 'drinks'); update categories set cat_description=2 where cat_id=1; drop table products, categories; +# +# MDEV-35081 - Assertion `!n_mysql_tables_in_use' failed after error +# upon binary logging of DML involving vector table +# +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +CREATE TABLE t (pk INT PRIMARY KEY, v VECTOR(1) NOT NULL, VECTOR(v)) ENGINE=InnoDB; +UPDATE t SET pk = 2 WHERE pk = 1; +ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. +DROP TABLE t; diff --git a/mysql-test/suite/binlog/t/binlog_innodb_stm.test b/mysql-test/suite/binlog/t/binlog_innodb_stm.test index 4dfa7a765841a..b1218a7645297 100644 --- a/mysql-test/suite/binlog/t/binlog_innodb_stm.test +++ b/mysql-test/suite/binlog/t/binlog_innodb_stm.test @@ -24,3 +24,17 @@ create table products( insert into categories values (1, 'drinks', 'drinks'); update categories set cat_description=2 where cat_id=1; drop table products, categories; + + +--echo # +--echo # MDEV-35081 - Assertion `!n_mysql_tables_in_use' failed after error +--echo # upon binary logging of DML involving vector table +--echo # +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +CREATE TABLE t (pk INT PRIMARY KEY, v VECTOR(1) NOT NULL, VECTOR(v)) ENGINE=InnoDB; + +--error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE +UPDATE t SET pk = 2 WHERE pk = 1; + +# Cleanup +DROP TABLE t; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index eb5f2af8be73c..4e9261a453b48 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -9830,7 +9830,6 @@ int TABLE::hlindex_lock(uint nr) DBUG_ASSERT(hlindex); if (hlindex->in_use == in_use) return 0; - hlindex->in_use= in_use; // mark in use for this query hlindex->use_all_columns(); THR_LOCK_DATA *lock_data; @@ -9839,6 +9838,8 @@ int TABLE::hlindex_lock(uint nr) int res= hlindex->file->ha_external_lock(in_use, reginfo.lock_type < TL_FIRST_WRITE ? F_RDLCK : F_WRLCK); + if (res == 0) + hlindex->in_use= in_use; // mark in use for this query if (hlindex->file->lock_count() > 0) { /*