summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNayuta Yanagisawa <nayuta.yanagisawa@hey.com>2022-01-21 01:59:25 +0900
committerNayuta Yanagisawa <nayuta.yanagisawa@hey.com>2022-01-21 02:00:05 +0900
commit2ada51ccd0d4368eea7d173163c36e2792990a10 (patch)
treee1ddfa03d3981bcb1c53986981185e5bbd4a1be3
parent66465914c1a22ae30f96a57aca7e8635a2506f8d (diff)
downloadmariadb-git-bb-10.5-MDEV-27239.tar.gz
MDEV-27239 Spider: Assertion `thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt' failed in ha_commit_trans on BEGIN WORK after FTWRLbb-10.5-MDEV-27239
The check on the SQL command type of the current statement is deleted by e954d9de. This resulted in the wrong call of spider_internal_start_trx() (and thus Ha_trx_info::register_ha()). I guess that the deletion is unintentional and is rather a mistake.
-rw-r--r--storage/spider/ha_spider.cc7
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_27239.result20
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27239.cnf2
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27239.test24
4 files changed, 49 insertions, 4 deletions
diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc
index d139b2ecea0..d35e2e4ac0f 100644
--- a/storage/spider/ha_spider.cc
+++ b/storage/spider/ha_spider.cc
@@ -1239,10 +1239,9 @@ int ha_spider::external_lock(
}
DBUG_RETURN(0);
}
- if (unlikely((error_num = spider_internal_start_trx(this))))
- {
- DBUG_RETURN(error_num);
- }
+ if (wide_handler->sql_command != SQLCOM_UNLOCK_TABLES)
+ if (unlikely((error_num = spider_internal_start_trx(this))))
+ DBUG_RETURN(error_num);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
} else {
trans_register_ha(trx->thd, FALSE, spider_hton_ptr);
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_27239.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_27239.result
new file mode 100644
index 00000000000..de135972a22
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_27239.result
@@ -0,0 +1,20 @@
+#
+# MDEV-27239 Spider: Assertion `thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt' failed in ha_commit_trans on BEGIN WORK after FTWRL
+#
+for master_1
+for child2
+for child3
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (a INT) ENGINE=SPIDER;
+FLUSH TABLE tbl_a WITH READ LOCK;
+Warnings:
+Error 1429 Unable to connect to foreign data source: localhost
+Error 1429 Unable to connect to foreign data source: localhost
+Error 1429 Unable to connect to foreign data source: localhost
+Error 1429 Unable to connect to foreign data source: localhost
+BEGIN;
+DROP DATABASE auto_test_local;
+for master_1
+for child2
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.cnf
new file mode 100644
index 00000000000..b0853e32654
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.cnf
@@ -0,0 +1,2 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.test
new file mode 100644
index 00000000000..3cf4bebd369
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27239.test
@@ -0,0 +1,24 @@
+--echo #
+--echo # MDEV-27239 Spider: Assertion `thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt' failed in ha_commit_trans on BEGIN WORK after FTWRL
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+CREATE TABLE tbl_a (a INT) ENGINE=SPIDER;
+FLUSH TABLE tbl_a WITH READ LOCK;
+BEGIN;
+
+DROP DATABASE auto_test_local;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log