mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-27902 Spider check trx and get conn in rnd_next()
This allows creation of SPIDER_CONN on demand, if the previous one was freed. Also, the first_link_idx's are reset during spider_check_trx_and_get_conn(), which in the case of remote HANDLER commands, might not match the link to use correct first_link_idx for remote HANDLER statement that was later set in ha_spider::rnd_handler_init() (causing testing regressions in the spider/handler suite). Therefore we fix the first_link_idx there.
This commit is contained in:
parent
85a36958e3
commit
696c2497fc
3 changed files with 116 additions and 0 deletions
|
@ -7182,6 +7182,8 @@ int ha_spider::rnd_next(
|
|||
DBUG_RETURN(error_num);
|
||||
use_pre_call = FALSE;
|
||||
}
|
||||
if ((error_num= spider_check_trx_and_get_conn(ha_thd(), this, FALSE)))
|
||||
DBUG_RETURN(error_num);
|
||||
DBUG_RETURN(rnd_next_internal(buf));
|
||||
}
|
||||
|
||||
|
@ -12553,6 +12555,9 @@ int ha_spider::rnd_handler_init()
|
|||
DBUG_RETURN(error_num);
|
||||
}
|
||||
set_handler_opened(roop_count);
|
||||
spider_db_handler *dbton_hdl=
|
||||
dbton_handler[share->sql_dbton_ids[conn_link_idx[roop_count]]];
|
||||
dbton_hdl->first_link_idx= roop_count;
|
||||
}
|
||||
}
|
||||
if (sql_kinds & SPIDER_SQL_KIND_HANDLER)
|
||||
|
|
55
storage/spider/mysql-test/spider/bugfix/r/mdev_27902.result
Normal file
55
storage/spider/mysql-test/spider/bugfix/r/mdev_27902.result
Normal file
|
@ -0,0 +1,55 @@
|
|||
#
|
||||
# MDEV-27902 Crashes, asserts, hangs and corruptions in Spider when using HANDLER
|
||||
#
|
||||
for master_1
|
||||
for child2
|
||||
for child3
|
||||
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
|
||||
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
|
||||
CREATE TABLE t (c INT) ENGINE=Spider;
|
||||
HANDLER t OPEN;
|
||||
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
|
||||
HANDLER t READ next;
|
||||
ERROR HY000: Unable to connect to foreign data source: localhost
|
||||
dummy;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'dummy' at line 1
|
||||
HANDLER t READ next;
|
||||
ERROR HY000: Unable to connect to foreign data source: localhost
|
||||
drop table t;
|
||||
CREATE TABLE t (c INT) ENGINE=Spider;
|
||||
HANDLER t OPEN;
|
||||
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
|
||||
HANDLER t READ FIRST;
|
||||
ERROR HY000: Unable to connect to foreign data source: localhost
|
||||
HANDLER t READ NEXT;
|
||||
ERROR HY000: Unable to connect to foreign data source: localhost
|
||||
drop table t;
|
||||
CREATE TABLE t (c INT) ENGINE=Spider;
|
||||
HANDLER t OPEN;
|
||||
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
|
||||
HANDLER t READ NEXT;
|
||||
ERROR HY000: Unable to connect to foreign data source: localhost
|
||||
SELECT * FROM t;
|
||||
ERROR HY000: Unable to connect to foreign data source: localhost
|
||||
HANDLER t READ NEXT;
|
||||
ERROR HY000: Unable to connect to foreign data source: localhost
|
||||
drop table t;
|
||||
drop server srv;
|
||||
for master_1
|
||||
for child2
|
||||
for child3
|
||||
#
|
||||
# end of test mdev_27902
|
||||
#
|
56
storage/spider/mysql-test/spider/bugfix/t/mdev_27902.test
Normal file
56
storage/spider/mysql-test/spider/bugfix/t/mdev_27902.test
Normal file
|
@ -0,0 +1,56 @@
|
|||
--echo #
|
||||
--echo # MDEV-27902 Crashes, asserts, hangs and corruptions in Spider when using HANDLER
|
||||
--echo #
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
|
||||
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
|
||||
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
|
||||
|
||||
# original case
|
||||
CREATE TABLE t (c INT) ENGINE=Spider;
|
||||
HANDLER t OPEN;
|
||||
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
|
||||
HANDLER t READ next;
|
||||
--error ER_PARSE_ERROR
|
||||
dummy;
|
||||
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
|
||||
HANDLER t READ next;
|
||||
|
||||
drop table t;
|
||||
|
||||
# case by nayuta
|
||||
CREATE TABLE t (c INT) ENGINE=Spider;
|
||||
HANDLER t OPEN;
|
||||
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
|
||||
HANDLER t READ FIRST;
|
||||
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
|
||||
HANDLER t READ NEXT;
|
||||
|
||||
drop table t;
|
||||
|
||||
# Another case by Roel
|
||||
CREATE TABLE t (c INT) ENGINE=Spider;
|
||||
HANDLER t OPEN;
|
||||
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
|
||||
HANDLER t READ NEXT;
|
||||
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
|
||||
SELECT * FROM t;
|
||||
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
|
||||
HANDLER t READ NEXT;
|
||||
|
||||
drop table t;
|
||||
|
||||
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_27902
|
||||
--echo #
|
Loading…
Add table
Reference in a new issue