diff options
author | Monty <monty@mariadb.org> | 2018-05-06 19:39:48 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-05-06 19:39:48 +0300 |
commit | 0bfd45f63419c45b68448cbd210a6e73e5c1ab34 (patch) | |
tree | 9670df2439fa5a3935ce0d7ff67d075dfc8b13b2 | |
parent | 529c1a3b6c36a7c1c9b8dae1feeb752a905fedbe (diff) | |
download | mariadb-git-0bfd45f63419c45b68448cbd210a6e73e5c1ab34.tar.gz |
Fix for MDEV-15812 Assert in SEQUENCE when forcing STATEMEMT format
The bug was the we copied the lock type to the underlying engine even when
external_lock failed.
-rw-r--r-- | mysql-test/suite/sql_sequence/replication_drop.result | 5 | ||||
-rw-r--r-- | mysql-test/suite/sql_sequence/replication_drop.test | 17 | ||||
-rw-r--r-- | sql/ha_sequence.cc | 3 |
3 files changed, 24 insertions, 1 deletions
diff --git a/mysql-test/suite/sql_sequence/replication_drop.result b/mysql-test/suite/sql_sequence/replication_drop.result new file mode 100644 index 00000000000..1cd7022765e --- /dev/null +++ b/mysql-test/suite/sql_sequence/replication_drop.result @@ -0,0 +1,5 @@ +CREATE SEQUENCE seq ENGINE=InnoDB; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +INSERT INTO seq VALUES (1,1,100,1,1,1,1,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 SEQUENCE seq; diff --git a/mysql-test/suite/sql_sequence/replication_drop.test b/mysql-test/suite/sql_sequence/replication_drop.test new file mode 100644 index 00000000000..ca050246391 --- /dev/null +++ b/mysql-test/suite/sql_sequence/replication_drop.test @@ -0,0 +1,17 @@ +# +# Test for MDEV-15812 +# Assertion `m_lock_type == 2' failed in +# handler::~handler on dropping a sequence after +# ER_BINLOG_STMT_MODE_AND_ROW_ENGINE +# + +--source include/have_innodb.inc +--source include/have_binlog_format_statement.inc + +CREATE SEQUENCE seq ENGINE=InnoDB; +SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; +--error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE +INSERT INTO seq VALUES (1,1,100,1,1,1,1,1); + +# Cleanup +DROP SEQUENCE seq; diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc index df9d9656c56..8bb5a98e39b 100644 --- a/sql/ha_sequence.cc +++ b/sql/ha_sequence.cc @@ -322,7 +322,8 @@ int ha_sequence::external_lock(THD *thd, int lock_type) Copy lock flag to satisfy DBUG_ASSERT checks in ha_* functions in handler.cc when we later call it with file->ha_..() */ - file->m_lock_type= lock_type; + if (!error) + file->m_lock_type= lock_type; return error; } |