2
--echo # Bug 35333 "If a Federated table can't connect to the remote hose, can't retrieve metadata"
4
--echo # Queries such as SHOW TABLE STATUS and SELECT * FROM INFORMATION_SCHEMA.TABLES fail
5
--echo # when encountering a federated table that cannot connect to its remote table.
7
--echo # The fix is to store the error text in the TABLE COMMENTS column of I_S.TABLES, clear
8
--echo # the remote connection error and push a warning instead. This allows the SELECT operation
9
--echo # to complete while still indicating a problem. This fix applies to any non-fatal system
10
--echo # error that occurs during a query against I_S.TABLES.de
12
--source federated.inc
15
CREATE DATABASE IF NOT EXISTS realdb;
16
# Federated database exists
17
DROP TABLE IF EXISTS realdb.t0;
18
DROP TABLE IF EXISTS federated.t0;
22
--echo # Create the base table to be referenced
24
CREATE TABLE realdb.t0 (a text, b text) ENGINE=MYISAM;
27
--echo # Create a federated table with a bogus port number
29
CREATE TABLE federated.t0 (a text, b text) ENGINE=FEDERATED
30
CONNECTION='mysql://root@127.0.0.1:63333/realdb/t0';
32
#--warning ER_CONNECT_TO_FOREIGN_DATA_SOURCE
35
--echo # Trigger a federated system error during a INFORMATION_SCHEMA.TABLES query
37
# Remove O/S-specific socket error
38
--replace_regex /\(.*\)/(socket errno)/
39
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
40
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'realdb' or TABLE_SCHEMA = 'federated';
42
# Remove O/S-specific socket error
43
--replace_regex /\(.*\)/(socket errno)/
47
--echo # Create a MyISAM table then corrupt the file
50
CREATE TABLE t1 (c1 int) ENGINE=MYISAM;
52
--echo # Corrupt the MyISAM table by deleting the base file
54
let $MYSQLD_DATADIR= `SELECT @@datadir`;
55
--remove_file $MYSQLD_DATADIR/realdb/t1.MYD
56
--remove_file $MYSQLD_DATADIR/realdb/t1.MYI
59
--echo # Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query
61
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
62
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
69
DROP TABLE IF EXISTS realdb.t0;
70
DROP TABLE IF EXISTS federated.t0;
74
--source federated_cleanup.inc