1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

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
This commit is contained in:
Sergei Golubchik
2021-01-10 21:51:36 +01:00
parent 0ee086838d
commit 3ffd5f28f0
3 changed files with 25 additions and 16 deletions

View File

@@ -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;

View File

@@ -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;