2
# Bug 35333 "If a Federated table can't connect to the remote hose, can't retrieve metadata"
4
# Queries such as SHOW TABLE STATUS and SELECT * FROM INFORMATION_SCHEMA.TABLES fail
5
# when encountering a federated table that cannot connect to its remote table.
7
# The fix is to store the error text in the TABLE COMMENTS column of I_S.TABLES, clear
8
# the remote connection error and push a warning instead. This allows the SELECT operation
9
# to complete while still indicating a problem. This fix applies to any non-fatal system
10
# error that occurs during a query against I_S.TABLES.de
11
CREATE DATABASE federated;
12
CREATE DATABASE federated;
13
CREATE DATABASE IF NOT EXISTS realdb;
14
DROP TABLE IF EXISTS realdb.t0;
15
DROP TABLE IF EXISTS federated.t0;
17
# Create the base table to be referenced
19
CREATE TABLE realdb.t0 (a text, b text) ENGINE=MYISAM;
21
# Create a federated table with a bogus port number
23
CREATE TABLE federated.t0 (a text, b text) ENGINE=FEDERATED
24
CONNECTION='mysql://root@127.0.0.1:63333/realdb/t0';
26
# Trigger a federated system error during a INFORMATION_SCHEMA.TABLES query
28
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
29
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'realdb' or TABLE_SCHEMA = 'federated';
30
TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_ROWS DATA_LENGTH TABLE_COMMENT
31
federated t0 BASE TABLE FEDERATED NULL 0 Unable to connect to foreign data source: Can't connect to MySQL server on '127.
32
realdb t0 BASE TABLE MyISAM Dynamic 0 0
34
Warning 1429 Unable to connect to foreign data source: Can't connect to MySQL server on '127.0.0.1' (socket errno)
37
Warning 1429 Unable to connect to foreign data source: Can't connect to MySQL server on '127.0.0.1' (socket errno)
39
# Create a MyISAM table then corrupt the file
42
CREATE TABLE t1 (c1 int) ENGINE=MYISAM;
44
# Corrupt the MyISAM table by deleting the base file
47
# Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query
49
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
50
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
51
TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_ROWS DATA_LENGTH TABLE_COMMENT
52
realdb t1 BASE TABLE NULL NULL NULL NULL Can't find file: 't1' (errno: 2)
54
Warning 1017 Can't find file: 't1' (errno: 2)
57
Warning 1017 Can't find file: 't1' (errno: 2)
61
DROP TABLE IF EXISTS realdb.t0;
62
DROP TABLE IF EXISTS federated.t0;
64
DROP TABLE IF EXISTS federated.t1;
65
DROP DATABASE federated;
66
DROP TABLE IF EXISTS federated.t1;
67
DROP DATABASE federated;