Skip to content

Commit 0bb9862

Browse files
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().
1 parent 696c249 commit 0bb9862

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

storage/spider/ha_spider.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,8 @@ int ha_spider::external_lock(
11301130
}
11311131
}
11321132

1133+
if ((error_num= spider_check_trx_and_get_conn(thd, this, FALSE)))
1134+
DBUG_RETURN(error_num);
11331135
if (!partition_handler || !partition_handler->handlers)
11341136
{
11351137
DBUG_RETURN(lock_tables()); /* Non-partitioned table */
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# MDEV-29962 SIGSEGV in ha_spider::lock_tables on BEGIN after table lock
3+
#
4+
for master_1
5+
for child2
6+
for child3
7+
set spider_same_server_link= 1;
8+
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
9+
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
10+
CREATE TABLE t (c INT) ENGINE=InnoDB;
11+
CREATE TABLE t1 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
12+
SELECT * FROM t1;
13+
c
14+
LOCK TABLES t1 WRITE CONCURRENT,t1 AS t2 READ;
15+
BEGIN;
16+
drop table t, t1;
17+
drop server srv;
18+
for master_1
19+
for child2
20+
for child3
21+
#
22+
# end of test mdev_29962
23+
#
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--echo #
2+
--echo # MDEV-29962 SIGSEGV in ha_spider::lock_tables on BEGIN after table lock
3+
--echo #
4+
--disable_query_log
5+
--disable_result_log
6+
--source ../../t/test_init.inc
7+
--enable_result_log
8+
--enable_query_log
9+
10+
set spider_same_server_link= 1;
11+
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
12+
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
13+
14+
CREATE TABLE t (c INT) ENGINE=InnoDB;
15+
CREATE TABLE t1 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"';
16+
SELECT * FROM t1;
17+
LOCK TABLES t1 WRITE CONCURRENT,t1 AS t2 READ;
18+
BEGIN;
19+
20+
drop table t, t1;
21+
drop server srv;
22+
23+
--disable_query_log
24+
--disable_result_log
25+
--source ../../t/test_deinit.inc
26+
--enable_result_log
27+
--enable_query_log
28+
--echo #
29+
--echo # end of test mdev_29962
30+
--echo #

0 commit comments

Comments
 (0)