Commit 0bb98628 authored by Yuchen Pei's avatar Yuchen Pei

MDEV-29962 Spider: creates connections if needed before lock_tables()

Same cause as MDEV-31996. This prevents reuse of conns freed
previously, e.g. during the commit of previous statement.

It does not occur in 10.4 because of the commit for MDEV-19002 removed
the call to spider_check_trx_and_get_conn().
parent 696c2497
......@@ -1130,6 +1130,8 @@ int ha_spider::external_lock(
}
}
if ((error_num= spider_check_trx_and_get_conn(thd, this, FALSE)))
DBUG_RETURN(error_num);
if (!partition_handler || !partition_handler->handlers)
{
DBUG_RETURN(lock_tables()); /* Non-partitioned table */
......
#
# MDEV-29962 SIGSEGV in ha_spider::lock_tables on BEGIN after table lock
#
for master_1
for child2
for child3
set spider_same_server_link= 1;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t (c INT) ENGINE=InnoDB;
CREATE TABLE t1 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
SELECT * FROM t1;
c
LOCK TABLES t1 WRITE CONCURRENT,t1 AS t2 READ;
BEGIN;
drop table t, t1;
drop server srv;
for master_1
for child2
for child3
#
# end of test mdev_29962
#
--echo #
--echo # MDEV-29962 SIGSEGV in ha_spider::lock_tables on BEGIN after table lock
--echo #
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
set spider_same_server_link= 1;
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t (c INT) ENGINE=InnoDB;
CREATE TABLE t1 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
SELECT * FROM t1;
LOCK TABLES t1 WRITE CONCURRENT,t1 AS t2 READ;
BEGIN;
drop table t, t1;
drop server srv;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log
--echo #
--echo # end of test mdev_29962
--echo #
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment