[Commits] 1cb2e03: MDEV-12466 : Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt || ...

Sergei Petrunia psergey at askmonty.org
Sat Apr 7 14:05:28 EEST 2018


revision-id: 1cb2e0333d3006f83370168c75d602edf2c3bfd1
parent(s): 5ccf3f96ac96662c39527997a359746088cef2fb
committer: Sergei Petrunia
branch nick: 10.2-r10
timestamp: 2018-04-07 14:05:28 +0300
message:

MDEV-12466 : Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt ||  ...

When "FLUSH TABLE ... FOR EXPORT" fails, the SQL layer should rollback
the statement. Otherwise we hit an assert when we try to close the
tables while having a non-empty list of statement transaction participants.

---
 sql/sql_reload.cc                                              |  2 ++
 storage/rocksdb/mysql-test/rocksdb/r/mariadb_port_fixes.result |  7 +++++++
 storage/rocksdb/mysql-test/rocksdb/t/mariadb_port_fixes.test   | 10 ++++++++++
 3 files changed, 19 insertions(+)

diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc
index 5d11387..ce3ff59 100644
--- a/sql/sql_reload.cc
+++ b/sql/sql_reload.cc
@@ -30,6 +30,7 @@
 #include "sql_show.h"
 #include "debug_sync.h"
 #include "des_key_file.h"
+#include "transaction.h"
 
 static void disable_checkpoints(THD *thd);
 
@@ -593,6 +594,7 @@ bool flush_tables_with_read_lock(THD *thd, TABLE_LIST *all_tables)
   return FALSE;
 
 error_reset_bits:
+  trans_rollback_stmt(thd);
   close_thread_tables(thd);
   thd->variables.option_bits&= ~OPTION_TABLE_LOCK;
 error:
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_port_fixes.result b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_port_fixes.result
index 27b1fd1..9674b2b 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_port_fixes.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_port_fixes.result
@@ -81,3 +81,10 @@ ROCKSDB_DDL	Gamma
 ROCKSDB_INDEX_FILE_MAP	Gamma
 ROCKSDB_LOCKS	Gamma
 ROCKSDB_TRX	Gamma
+#
+#  MDEV-12466 : Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt ||  ...
+#
+CREATE TABLE t1 (i INT) ENGINE=RocksDB;
+FLUSH TABLE t1 FOR EXPORT;
+ERROR HY000: Storage engine ROCKSDB of the table `test`.`t1` doesn't have this option
+DROP TABLE t1;
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_port_fixes.test b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_port_fixes.test
index 980f2e3..681e3d2 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_port_fixes.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_port_fixes.test
@@ -73,3 +73,13 @@ set global rocksdb_strict_collation_check=@tmp_rscc;
 --echo #
 select plugin_name, plugin_maturity from information_schema.plugins where plugin_name like '%rocksdb%';
 
+
+--echo #
+--echo #  MDEV-12466 : Assertion `thd->transaction.stmt.is_empty() || thd->in_sub_stmt ||  ...
+--echo #
+
+CREATE TABLE t1 (i INT) ENGINE=RocksDB;
+--error ER_ILLEGAL_HA
+FLUSH TABLE t1 FOR EXPORT;
+DROP TABLE t1;
+


More information about the commits mailing list