| 1 |
# |
| 2 |
# Bug 35333 "If a Federated table can't connect to the remote hose, can't retrieve metadata" |
| 3 |
# |
| 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. |
| 6 |
# |
| 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 |
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,; |
| 12 |
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; |
| 13 |
connection master; |
| 14 |
CREATE DATABASE federated; |
| 15 |
connection slave; |
| 16 |
CREATE DATABASE federated; |
| 17 |
DROP TABLE IF EXISTS federated.t0; |
| 18 |
# |
| 19 |
# Create a MyISAM table then corrupt the file |
| 20 |
# |
| 21 |
CREATE TABLE t1 (c1 int) ENGINE=MYISAM; |
| 22 |
# |
| 23 |
# Corrupt the MyISAM table by deleting the base file |
| 24 |
# |
| 25 |
# |
| 26 |
# Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query |
| 27 |
# |
| 28 |
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT |
| 29 |
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; |
| 30 |
TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_ROWS DATA_LENGTH TABLE_COMMENT |
| 31 |
test t1 BASE TABLE NULL NULL NULL NULL Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") |
| 32 |
Warnings: |
| 33 |
Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") |
| 34 |
DROP TABLE t1; |
| 35 |
Warnings: |
| 36 |
Warning 1017 Can't find file: './test/t1.MYI' (errno: 2 "No such file or directory") |
| 37 |
# |
| 38 |
# Cleanup |
| 39 |
# |
| 40 |
connection master; |
| 41 |
DROP TABLE IF EXISTS federated.t1; |
| 42 |
DROP DATABASE IF EXISTS federated; |
| 43 |
connection slave; |
| 44 |
DROP TABLE IF EXISTS federated.t1; |
| 45 |
DROP DATABASE IF EXISTS federated; |