#At file:///home/satya/WORK/mysql-5.1-bugteam-21360/ based on revid:kgeorge@stripped
2828 Satya B 2009-02-27
Fix for BUG#21360 - mysqldump error on federated tables
When a mysqldump tool is used to dump federated tables,
an error is thrown saying storage engine for the table
doesn't have this option.
mysqldump tries to re-insert the data into the federated
table which causes the error. Since the data is already
available on the remote server, mysqldump shouldn't try
to dump the data again for FEDERATED tables.
As stated it the bug page, it can be considered similar
to the MERGE ENGINE with "view only" nature.
Fixed by adding the "FEDERATED ENGINE" to the exception
list to mysqldump tool
modified:
client/mysqldump.c
mysql-test/suite/federated/federated.result
mysql-test/suite/federated/federated.test
per-file messages:
client/mysqldump.c
Fixed check_if_ignore_table() to ignore FEDERATED engine
when dumping the tables.
mysql-test/suite/federated/federated.result
Result file generated to test mysqldump errors on federated tables
mysql-test/suite/federated/federated.test
Added test case to test mysqldump errors on federated tables
=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c 2009-02-19 17:22:28 +0000
+++ b/client/mysqldump.c 2009-02-27 13:59:26 +0000
@@ -4584,11 +4584,13 @@ char check_if_ignore_table(const char *t
}
/*
- If these two types, we do want to skip dumping the table
+ If these types, we do want to skip dumping the table
*/
if (!opt_no_data &&
- (!my_strcasecmp(&my_charset_latin1, table_type, "MRG_MyISAM") ||
- !strcmp(table_type,"MRG_ISAM")))
+ ((!my_strcasecmp(&my_charset_latin1, table_type, "MRG_MyISAM") ||
+ !strcmp(table_type,"MRG_ISAM")) ||
+ (!my_strcasecmp(&my_charset_latin1, table_type, "FEDERATED") ||
+ !strcmp(table_type,"FEDERATED"))))
result= IGNORE_DATA;
}
mysql_free_result(res);
=== modified file 'mysql-test/suite/federated/federated.result'
--- a/mysql-test/suite/federated/federated.result 2009-02-02 11:36:03 +0000
+++ b/mysql-test/suite/federated/federated.result 2009-02-27 13:59:26 +0000
@@ -2130,6 +2130,20 @@ SELECT t1.a FROM t1, t1 as t2 WHERE t2.b
a
DROP TABLE t1;
DROP TABLE t1;
+#Switch to Connection Slave
+CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id));
+INSERT INTO t1 VALUES ('text1'),('text2'),('text3'),('text4');
+#Switch to Connection Master
+CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)) ENGINE=FEDERATED CONNECTION='mysql://root@stripped:12501/test/t1';
+INSERT INTO t1 VALUES('text5'),('text6'),('text7'),('text8');
+FLUSH TABLE t1;
+#Switch to Connection Slave
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+8
+DROP TABLE t1;
+#Switch to Connection Master
+DROP TABLE t1;
End of 5.0 tests
create server 's1' foreign data wrapper 'mysql' options (port 3306);
drop server 's1';
=== modified file 'mysql-test/suite/federated/federated.test'
--- a/mysql-test/suite/federated/federated.test 2008-12-13 19:42:12 +0000
+++ b/mysql-test/suite/federated/federated.test 2009-02-27 13:59:26 +0000
@@ -1942,6 +1942,28 @@ DROP TABLE t1;
connection master;
DROP TABLE t1;
+#
+# BUG#21360 - mysqldump error on federated tables
+#
+connection slave;
+--echo #Switch to Connection Slave
+CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id));
+INSERT INTO t1 VALUES ('text1'),('text2'),('text3'),('text4');
+connection master;
+--echo #Switch to Connection Master
+eval CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)) ENGINE=FEDERATED CONNECTION='mysql://root@stripped:$SLAVE_MYPORT/test/t1';
+INSERT INTO t1 VALUES('text5'),('text6'),('text7'),('text8');
+FLUSH TABLE t1;
+--exec $MYSQL_DUMP --databases test > $MYSQLTEST_VARDIR/tmp/mysqldump.sql
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqldump.sql
+connection slave;
+--echo #Switch to Connection Slave
+SELECT COUNT(*) FROM t1;
+DROP TABLE t1;
+connection master;
+--echo #Switch to Connection Master
+DROP TABLE t1;
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqldump.sql
connection default;
--echo End of 5.0 tests
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (satya.bn:2828) Bug#21360 | Satya B | 27 Feb |