From 99794e880121f4babaf33eb5851410a0919eeaa7 Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Tue, 12 May 2009 10:38:14 -0700 Subject: [PATCH 1/5] mysqldump would not dump the INFORMATION_SCHEMA even when it was explicitly requested. (Bug #33762) --- client/mysqldump.c | 18 +++++++++++++----- mysql-test/r/mysqldump.result | 36 ++++++++++++++++++++++++++++++++--- mysql-test/t/mysqldump.test | 10 +++++++--- 3 files changed, 53 insertions(+), 11 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 323376dd8bf..efcb1820be4 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -3813,6 +3813,10 @@ static int dump_all_databases() return 1; while ((row= mysql_fetch_row(tableres))) { + if (mysql_get_server_version(mysql) >= 50003 && + !my_strcasecmp(&my_charset_latin1, row[0], "information_schema")) + continue; + if (dump_all_tables_in_db(row[0])) result=1; } @@ -3827,6 +3831,10 @@ static int dump_all_databases() } while ((row= mysql_fetch_row(tableres))) { + if (mysql_get_server_version(mysql) >= 50003 && + !my_strcasecmp(&my_charset_latin1, row[0], "information_schema")) + continue; + if (dump_all_views_in_db(row[0])) result=1; } @@ -3933,10 +3941,6 @@ int init_dumping_tables(char *qdatabase) static int init_dumping(char *database, int init_func(char*)) { - if (mysql_get_server_version(mysql) >= 50003 && - !my_strcasecmp(&my_charset_latin1, database, "information_schema")) - return 1; - if (mysql_select_db(mysql, database)) { DB_error(mysql, "when selecting the database"); @@ -3995,6 +3999,7 @@ static int dump_all_tables_in_db(char *database) DBUG_RETURN(1); if (opt_xml) print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS); + if (lock_tables) { DYNAMIC_STRING query; @@ -4228,7 +4233,10 @@ static int dump_selected_tables(char *db, char **table_names, int tables) } end= pos; - if (lock_tables) + /* Can't LOCK TABLES in INFORMATION_SCHEMA, so don't try. */ + if (lock_tables && + !(mysql_get_server_version(mysql) >= 50003 && + !my_strcasecmp(&my_charset_latin1, db, "information_schema"))) { if (mysql_real_query(mysql, lock_tables_query.str, lock_tables_query.length-1)) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index c97131563cb..4b658f69371 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -3563,9 +3563,6 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; drop table t1; drop user mysqltest_1@localhost; # -# Bug#21527 mysqldump incorrectly tries to LOCK TABLES on the -# information_schema database. -# # Bug#21424 mysqldump failing to export/import views # create database mysqldump_myDB; @@ -3605,6 +3602,39 @@ drop user myDB_User@localhost; drop database mysqldump_myDB; use test; # +# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the +# information_schema database. +# +# Bug #33762: mysqldump can not dump INFORMATION_SCHEMA +# +DROP TABLE IF EXISTS `TABLES`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TEMPORARY TABLE `TABLES` ( + `TABLE_CATALOG` varchar(512) DEFAULT NULL, + `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '', + `TABLE_NAME` varchar(64) NOT NULL DEFAULT '', + `TABLE_TYPE` varchar(64) NOT NULL DEFAULT '', + `ENGINE` varchar(64) DEFAULT NULL, + `VERSION` bigint(21) unsigned DEFAULT NULL, + `ROW_FORMAT` varchar(10) DEFAULT NULL, + `TABLE_ROWS` bigint(21) unsigned DEFAULT NULL, + `AVG_ROW_LENGTH` bigint(21) unsigned DEFAULT NULL, + `DATA_LENGTH` bigint(21) unsigned DEFAULT NULL, + `MAX_DATA_LENGTH` bigint(21) unsigned DEFAULT NULL, + `INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL, + `DATA_FREE` bigint(21) unsigned DEFAULT NULL, + `AUTO_INCREMENT` bigint(21) unsigned DEFAULT NULL, + `CREATE_TIME` datetime DEFAULT NULL, + `UPDATE_TIME` datetime DEFAULT NULL, + `CHECK_TIME` datetime DEFAULT NULL, + `TABLE_COLLATION` varchar(32) DEFAULT NULL, + `CHECKSUM` bigint(21) unsigned DEFAULT NULL, + `CREATE_OPTIONS` varchar(255) DEFAULT NULL, + `TABLE_COMMENT` varchar(80) NOT NULL DEFAULT '' +) ENGINE=MEMORY DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; +# # Bug#19745 mysqldump --xml produces invalid xml # DROP TABLE IF EXISTS t1; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index fe89d7bdafa..34ffbe4372b 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1395,9 +1395,6 @@ drop table t1; drop user mysqltest_1@localhost; ---echo # ---echo # Bug#21527 mysqldump incorrectly tries to LOCK TABLES on the ---echo # information_schema database. --echo # --echo # Bug#21424 mysqldump failing to export/import views --echo # @@ -1464,6 +1461,13 @@ disconnect root; --remove_file $MYSQLTEST_VARDIR/tmp/bug21527.sql use test; +--echo # +--echo # Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the +--echo # information_schema database. +--echo # +--echo # Bug #33762: mysqldump can not dump INFORMATION_SCHEMA +--echo # +--exec $MYSQL_DUMP --compact --opt -d information_schema tables --echo # --echo # Bug#19745 mysqldump --xml produces invalid xml From eae91cc7810c53536423d450b318824e0e96ace0 Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Tue, 12 May 2009 10:45:40 -0700 Subject: [PATCH 2/5] mysqlimport was not always compiled correctly to allow thread support, required for the --use-threads option. (Bug #32991) --- client/Makefile.am | 2 +- mysql-test/r/mysqldump.result | 175 ++++++++++++++++++++++++++++++++++ mysql-test/t/mysqldump.test | 5 - 3 files changed, 176 insertions(+), 6 deletions(-) diff --git a/client/Makefile.am b/client/Makefile.am index 94db565ba37..ab5bc8d601a 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -71,7 +71,7 @@ mysqldump_SOURCES= mysqldump.c \ $(top_srcdir)/mysys/mf_getdate.c mysqlimport_SOURCES= mysqlimport.c - +mysqlimport_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ @CLIENT_EXTRA_LDFLAGS@ \ $(LIBMYSQLCLIENT_LA) \ diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 4b658f69371..7e987df8166 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -4036,6 +4036,181 @@ UNLOCK TABLES; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; +create table t1 (a text , b text); +create table t2 (a text , b text); +insert t1 values ("Duck, Duck", "goose"); +insert t1 values ("Duck, Duck", "pidgeon"); +insert t2 values ("We the people", "in order to perform"); +insert t2 values ("a more perfect", "union"); +select * from t1; +a b +Duck, Duck goose +Duck, Duck pidgeon +select * from t2; +a b +We the people in order to perform +a more perfect union +test.t1: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 +test.t2: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0 +select * from t1; +a b +Duck, Duck goose +Duck, Duck pidgeon +Duck, Duck goose +Duck, Duck pidgeon +select * from t2; +a b +We the people in order to perform +a more perfect union +We the people in order to perform +a more perfect union +create table words(a varchar(255)); +create table words2(b varchar(255)); +select * from t1; +a b +Duck, Duck goose +Duck, Duck pidgeon +Duck, Duck goose +Duck, Duck pidgeon +Duck, Duck goose +Duck, Duck pidgeon +select * from t2; +a b +We the people in order to perform +a more perfect union +We the people in order to perform +a more perfect union +We the people in order to perform +a more perfect union +select * from words; +a +Aarhus +Aaron +Ababa +aback +abaft +abandon +abandoned +abandoning +abandonment +abandons +Aarhus +Aaron +Ababa +aback +abaft +abandon +abandoned +abandoning +abandonment +abandons +abase +abased +abasement +abasements +abases +abash +abashed +abashes +abashing +abasing +abate +abated +abatement +abatements +abater +abates +abating +Abba +abbe +abbey +abbeys +abbot +abbots +Abbott +abbreviate +abbreviated +abbreviates +abbreviating +abbreviation +abbreviations +Abby +abdomen +abdomens +abdominal +abduct +abducted +abduction +abductions +abductor +abductors +abducts +Abe +abed +Abel +Abelian +Abelson +Aberdeen +Abernathy +aberrant +aberration +select * from words2; +b +abase +abased +abasement +abasements +abases +abash +abashed +abashes +abashing +abasing +abate +abated +abatement +abatements +abater +abates +abating +Abba +abbe +abbey +abbeys +abbot +abbots +Abbott +abbreviate +abbreviated +abbreviates +abbreviating +abbreviation +abbreviations +Abby +abdomen +abdomens +abdominal +abduct +abducted +abduction +abductions +abductor +abductors +abducts +Abe +abed +Abel +Abelian +Abelson +Aberdeen +Abernathy +aberrant +aberration +drop table words; +mysql-import: Error: 1146, Table 'test.words' doesn't exist, when using table: words +drop table t1; +drop table t2; +drop table words2; # # Bug#16853 mysqldump doesn't show events # diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 34ffbe4372b..2bc25c4929a 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1703,9 +1703,6 @@ DROP TABLE t1; # Added for use-thread option # -# THIS PART OF THE TEST IS DISABLED UNTIL Bug#32991 IS FIXED -if ($bug32991_fixed) { - create table t1 (a text , b text); create table t2 (a text , b text); insert t1 values ("Duck, Duck", "goose"); @@ -1743,8 +1740,6 @@ drop table t2; drop table words2; -} - --echo # --echo # Bug#16853 mysqldump doesn't show events --echo # From 68bf2c03fb05eed8d4ec8821bdcb630cf51793c6 Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Fri, 15 May 2009 12:24:45 -0700 Subject: [PATCH 3/5] Fix test case, table name needs to be upper-case. --- mysql-test/t/mysqldump.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 2bc25c4929a..64d1036e264 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1467,7 +1467,7 @@ use test; --echo # --echo # Bug #33762: mysqldump can not dump INFORMATION_SCHEMA --echo # ---exec $MYSQL_DUMP --compact --opt -d information_schema tables +--exec $MYSQL_DUMP --compact --opt -d information_schema TABLES --echo # --echo # Bug#19745 mysqldump --xml produces invalid xml From 261238b9247e6a9c1e258a45fd138c29ed39d5c3 Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Fri, 15 May 2009 13:12:20 -0700 Subject: [PATCH 4/5] Remove out-of-date and unnecessary comment in source code about what versions are supported. (Bug #42021) --- client/mysqlbinlog.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 2c2023ae129..2c74d745f01 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -17,10 +17,8 @@ TODO: print the catalog (some USE catalog.db ????). - Standalone program to read a MySQL binary log (or relay log); - can read files produced by 3.23, 4.x, 5.0 servers. + Standalone program to read a MySQL binary log (or relay log). - Can read binlogs from 3.23/4.x/5.0 and relay logs from 4.x/5.0. Should be able to read any file of these categories, even with --start-position. An important fact: the Format_desc event of the log is at most the 3rd event From 2a4e1220c8a382e4f7d15da714d465558b0de685 Mon Sep 17 00:00:00 2001 From: Jim Winstead Date: Fri, 15 May 2009 13:25:22 -0700 Subject: [PATCH 5/5] Add usage for --base64-output=DECODE-ROWS and note that UNSPEC is intentionally unmentioned (it is just a placeholder). (Bug #41403) --- client/mysqlbinlog.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 2c74d745f01..aeaf49b5a15 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -932,10 +932,13 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"base64-output", OPT_BASE64_OUTPUT_MODE, + /* 'unspec' is not mentioned because it is just a placeholder. */ "Determine when the output statements should be base64-encoded BINLOG " "statements: 'never' disables it and works only for binlogs without " "row-based events; 'auto' is the default and prints base64 only when " "necessary (i.e., for row-based events and format description events); " + "'decode-rows' suppresses BINLOG statements for row events, but does " + "not exit as an error if a row event is found, unlike 'never'; " "'always' prints base64 whenever possible. 'always' is for debugging " "only and should not be used in a production system. The default is " "'auto'. --base64-output is a short form for --base64-output=always."