From 2ada51ccd0d4368eea7d173163c36e2792990a10 Mon Sep 17 00:00:00 2001 From: Nayuta Yanagisawa Date: Fri, 21 Jan 2022 01:59:25 +0900 Subject: MDEV-27239 Spider: Assertion `thd->transaction->stmt.ha_list == __null || trans == &thd->transaction->stmt' failed in ha_commit_trans on BEGIN WORK after FTWRL 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. --- storage/spider/ha_spider.cc | 7 +++---- .../mysql-test/spider/bugfix/r/mdev_27239.result | 20 ++++++++++++++++++ .../mysql-test/spider/bugfix/t/mdev_27239.cnf | 2 ++ .../mysql-test/spider/bugfix/t/mdev_27239.test | 24 ++++++++++++++++++++++ 4 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_27239.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_27239.cnf create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_27239.test 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 -- cgit v1.2.1