~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to mysql-test/suite/federated/federated_bug_35333.test

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 federated.inc
 
13
 
 
14
--disable_warnings
 
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;
 
19
--enable_warnings
 
20
 
 
21
--echo #
 
22
--echo # Create the base table to be referenced
 
23
--echo #
 
24
CREATE TABLE realdb.t0 (a text, b text) ENGINE=MYISAM;
 
25
 
 
26
--echo #
 
27
--echo # Create a federated table with a bogus port number
 
28
--echo #
 
29
CREATE TABLE federated.t0 (a text, b text) ENGINE=FEDERATED
 
30
    CONNECTION='mysql://root@127.0.0.1:63333/realdb/t0';
 
31
 
 
32
#--warning ER_CONNECT_TO_FOREIGN_DATA_SOURCE
 
33
 
 
34
--echo #
 
35
--echo # Trigger a federated system error during a INFORMATION_SCHEMA.TABLES query
 
36
--echo #
 
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';
 
41
 
 
42
# Remove O/S-specific socket error
 
43
--replace_regex /\(.*\)/(socket errno)/
 
44
SHOW WARNINGS;
 
45
 
 
46
--echo #
 
47
--echo # Create a MyISAM table then corrupt the file
 
48
--echo #
 
49
USE realdb;
 
50
CREATE TABLE t1 (c1 int) ENGINE=MYISAM;
 
51
--echo #
 
52
--echo # Corrupt the MyISAM table by deleting the base file
 
53
--echo #
 
54
let $MYSQLD_DATADIR= `SELECT @@datadir`;
 
55
--remove_file $MYSQLD_DATADIR/realdb/t1.MYD
 
56
--remove_file $MYSQLD_DATADIR/realdb/t1.MYI
 
57
 
 
58
--echo #
 
59
--echo # Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query
 
60
--echo #
 
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';
 
63
 
 
64
SHOW WARNINGS;
 
65
--echo #
 
66
--echo # Cleanup
 
67
--echo #
 
68
--disable_warnings
 
69
DROP TABLE IF EXISTS realdb.t0;
 
70
DROP TABLE IF EXISTS federated.t0;
 
71
DROP DATABASE realdb;
 
72
--enable_warnings
 
73
 
 
74
--source federated_cleanup.inc