Commit 3ffd5f28 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-17227 Server crash in TABLE_SHARE::init_from_sql_statement_string upon...

MDEV-17227 Server crash in TABLE_SHARE::init_from_sql_statement_string upon table discovery with non-existent database

* failed init_from_binary_frm_image can clear share->db_plugin,
  don't use it on the error path
* cleanup the test a bit
parent 0ee08683
......@@ -13,8 +13,7 @@ CREATE TABLE t1 (
`name` varchar(32) default 'name')
DEFAULT CHARSET=latin1;
connection master;
CREATE TABLE t1 ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
CREATE TABLE t1 ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
......@@ -38,6 +37,9 @@ id group a\\b a\\ name
1 1 2 NULL foo
2 1 2 NULL fee
DROP TABLE t1;
#
# MDEV-11311 Create federated table does not work as expected
#
create table t1 (
a bigint(20) not null auto_increment,
b bigint(20) not null,
......@@ -57,8 +59,7 @@ t1 CREATE TABLE `t1` (
KEY `b` (`b`,`c`,`d`(255))
) ENGINE=MyISAM DEFAULT CHARSET=latin1
connection master;
create table t1 engine=federated
connection='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
create table t1 engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
......@@ -72,6 +73,12 @@ t1 CREATE TABLE `t1` (
drop table t1;
connection slave;
drop table t1;
#
# MDEV-17227 Server crash in TABLE_SHARE::init_from_sql_statement_string upon table discovery with non-existent database
#
connection master;
create table t1 engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
ERROR HY000: Unable to connect to foreign data source: Table 'test.t1' doesn't exist
connection master;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
......
......@@ -13,9 +13,7 @@ CREATE TABLE t1 (
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE t1 ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
evalp CREATE TABLE t1 ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
--replace_result $SLAVE_MYPORT SLAVE_PORT
SHOW CREATE TABLE t1;
......@@ -30,9 +28,9 @@ connection slave;
SELECT * FROM t1;
DROP TABLE t1;
#
#
#
--echo #
--echo # MDEV-11311 Create federated table does not work as expected
--echo #
create table t1 (
a bigint(20) not null auto_increment,
b bigint(20) not null,
......@@ -44,9 +42,7 @@ create table t1 (
show create table t1;
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval create table t1 engine=federated
connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
evalp create table t1 engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
--replace_result $SLAVE_MYPORT SLAVE_PORT
show create table t1;
drop table t1;
......@@ -54,5 +50,12 @@ drop table t1;
connection slave;
drop table t1;
--echo #
--echo # MDEV-17227 Server crash in TABLE_SHARE::init_from_sql_statement_string upon table discovery with non-existent database
--echo #
connection master;
--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE
evalp create table t1 engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
source include/federated_cleanup.inc;
......@@ -2869,9 +2869,8 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
if (unlikely(thd->is_error() || error))
{
thd->clear_error();
my_error(ER_SQL_DISCOVER_ERROR, MYF(0),
plugin_name(db_plugin)->str, db.str, table_name.str,
sql_copy);
my_error(ER_SQL_DISCOVER_ERROR, MYF(0), hton_name(hton)->str,
db.str, table_name.str, sql_copy);
DBUG_RETURN(HA_ERR_GENERIC);
}
/* Treat the table as normal table from binary logging point of view */
......
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