Debian Codegraph @

mysql-test/suite/federated/federated_bug_35333.test

raw
1 --echo #
2 --echo # Bug 35333 "If a Federated table can't connect to the remote hose, can't retrieve metadata"
3 --echo #
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.
6 --echo #
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
11
12 --source suite/federated/include/federated.inc
13
14 --disable_warnings
15 # Federated database exists
16 DROP TABLE IF EXISTS federated.t0;
17 --enable_warnings
18
19 --disable_parsing
20 # This test doesn't work with federatedx, as it doesn't allow wrong connections
21
22 --echo #
23 --echo # Create the base table to be referenced
24 --echo #
25 CREATE TABLE realdb.t0 (a text, b text) ENGINE=MYISAM;
26
27 --echo #
28 --echo # Create a federated table with a bogus port number
29 --echo #
30 CREATE TABLE federated.t0 (a text, b text) ENGINE=FEDERATED
31 CONNECTION='mysql://[email protected]:63333/realdb/t0';
32
33 #--warning ER_CONNECT_TO_FOREIGN_DATA_SOURCE
34
35 --echo #
36 --echo # Trigger a federated system error during a INFORMATION_SCHEMA.TABLES query
37 --echo #
38 # Remove O/S-specific socket error
39 --replace_regex /\(.*\)/(socket errno)/
40 SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
41 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'realdb' or TABLE_SCHEMA = 'federated';
42
43 # Remove O/S-specific socket error
44 --replace_regex /\(.*\)/(socket errno)/
45 SHOW WARNINGS;
46 DROP TABLE federated.t0;
47
48 --enable_parsing
49
50 --echo #
51 --echo # Create a MyISAM table then corrupt the file
52 --echo #
53 CREATE TABLE t1 (c1 int) ENGINE=MYISAM;
54 --echo #
55 --echo # Corrupt the MyISAM table by deleting the base file
56 --echo #
57 let $MYSQLD_DATADIR= `SELECT @@datadir`;
58 --remove_file $MYSQLD_DATADIR/test/t1.MYD
59 --remove_file $MYSQLD_DATADIR/test/t1.MYI
60
61 --echo #
62 --echo # Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query
63 --echo #
64 --replace_result 20 2
65 SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
66 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
67
68 DROP TABLE t1;
69
70 --echo #
71 --echo # Cleanup
72 --echo #
73
74 --source suite/federated/include/federated_cleanup.inc