Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-35081 - Assertion `!n_mysql_tables_in_use' failed after error up… #3798

Open
wants to merge 1 commit into
base: 11.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions mysql-test/suite/binlog/r/binlog_innodb_stm.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
14 changes: 14 additions & 0 deletions mysql-test/suite/binlog/t/binlog_innodb_stm.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;
3 changes: 2 additions & 1 deletion sql/sql_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
/*
Expand Down