From: Date: December 18 2008 8:30am Subject: bzr commit into mysql-6.0-falcon-team branch (svoj:2934) Bug#33148 List-Archive: http://lists.mysql.com/commits/61937 X-Bug: 33148 Message-Id: <20081218073053.B1C0841CED0@june.myoffice.izhnet.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT #At file:///home/svoj/devel/bzr-mysql/mysql-6.0-falcon-team-bug33148/ 2934 Sergey Vojtovich 2008-12-18 BUG#33148 - falcon mysqldump does not include tablespace info mysqldump didn't include tablespace definition when dumping Falcon tables, that use custom tablespaces. With this fix Falcon tablespace definition is dumped. added: mysql-test/suite/falcon/r/falcon_bug_33148.result mysql-test/suite/falcon/t/falcon_bug_33148.test modified: client/mysqldump.c sql/sql_show.cc per-file messages: client/mysqldump.c Removed " AND ENGINE != 'Falcon'" from query for undo log files. It doesn't make any sense, since Falcon never sets FILE_TYPE to 'UNDO LOG'. Removed " AND ENGINE != 'Falcon'" from query for data files, as now we want to have them dumped. Also as Falcon sets FILE_TYPE to 'USER DATAFILE' for tablespaces, added this type into query condition. For tablespace data files, Falcon sets most fields in I_S.FILES to NULL, including LOGFILE_GROUP_NAME and INITIAL_SIZE. Output these tablespace create options conditionally. mysql-test/suite/falcon/r/falcon_bug_33148.result A test case for BUG#33148. mysql-test/suite/falcon/t/falcon_bug_33148.test A test case for BUG#33148. sql/sql_show.cc Fixed that INFORMATION_SCHEMA.PARTITIONS didn't fill TABLESPACE_NAME column for non-partitioned tables. === modified file 'client/mysqldump.c' --- a/client/mysqldump.c 2008-10-20 19:13:22 +0000 +++ b/client/mysqldump.c 2008-12-18 07:30:35 +0000 @@ -3691,7 +3691,6 @@ static int dump_tablespaces(char* ts_whe " EXTRA" " FROM INFORMATION_SCHEMA.FILES" " WHERE FILE_TYPE = 'UNDO LOG'" - " AND ENGINE != 'Falcon'" " AND FILE_NAME IS NOT NULL", 256, 1024); if(ts_where) @@ -3788,8 +3787,7 @@ static int dump_tablespaces(char* ts_whe " INITIAL_SIZE," " ENGINE" " FROM INFORMATION_SCHEMA.FILES" - " WHERE FILE_TYPE = 'DATAFILE'" - " AND ENGINE != 'Falcon'", + " WHERE FILE_TYPE IN('DATAFILE', 'USER DATAFILE')", 256, 1024); if(ts_where) @@ -3828,17 +3826,14 @@ static int dump_tablespaces(char* ts_whe row[1]); if (first) { - fprintf(md_result_file, - " USE LOGFILE GROUP %s\n" - " EXTENT_SIZE %s\n", - row[2], - row[3]); - } - fprintf(md_result_file, - " INITIAL_SIZE %s\n" - " ENGINE=%s;\n", - row[4], - row[5]); + if (row[2]) + fprintf(md_result_file, " USE LOGFILE GROUP %s\n", row[2]); + if (row[3]) + fprintf(md_result_file, " EXTENT_SIZE %s\n", row[3]); + } + if (row[4]) + fprintf(md_result_file, " INITIAL_SIZE %s\n", row[4]); + fprintf(md_result_file, " ENGINE=%s;\n", row[5]); check_io(md_result_file); if (first) { === added file 'mysql-test/suite/falcon/r/falcon_bug_33148.result' --- a/mysql-test/suite/falcon/r/falcon_bug_33148.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/falcon/r/falcon_bug_33148.result 2008-12-18 07:30:35 +0000 @@ -0,0 +1,18 @@ +*** Bug #33148 *** +SET @@storage_engine = 'Falcon'; +DROP TABLE IF EXISTS t1; +CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=Falcon; +CREATE TABLE t1(a INT) ENGINE=Falcon TABLESPACE ts1; + +CREATE TABLESPACE ts1 + ADD DATAFILE 'ts1.fts' + EXTENT_SIZE 0 + ENGINE=Falcon; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) /*!50100 TABLESPACE `ts1` */ ENGINE=Falcon DEFAULT CHARSET=latin1; +SET character_set_client = @saved_cs_client; +DROP TABLE t1; +DROP TABLESPACE ts1 ENGINE=Falcon; === added file 'mysql-test/suite/falcon/t/falcon_bug_33148.test' --- a/mysql-test/suite/falcon/t/falcon_bug_33148.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/falcon/t/falcon_bug_33148.test 2008-12-18 07:30:35 +0000 @@ -0,0 +1,34 @@ +--source include/have_falcon.inc +--source include/not_embedded.inc + +# +# Bug #33148: falcon mysqldump does not include tablespace info +# +--echo *** Bug #33148 *** + +# ----------------------------------------------------- # +# --- Initialisation --- # +# ----------------------------------------------------- # +let $engine = 'Falcon'; +eval SET @@storage_engine = $engine; + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# ----------------------------------------------------- # +# --- Test --- # +# ----------------------------------------------------- # +CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=Falcon; +CREATE TABLE t1(a INT) ENGINE=Falcon TABLESPACE ts1; + +# ----------------------------------------------------- # +# --- Check --- # +# ----------------------------------------------------- # +--exec $MYSQL_DUMP --compact test t1 + +# ----------------------------------------------------- # +# --- Final cleanup --- # +# ----------------------------------------------------- # +DROP TABLE t1; +DROP TABLESPACE ts1 ENGINE=Falcon; === modified file 'sql/sql_show.cc' --- a/sql/sql_show.cc 2008-12-08 11:29:15 +0000 +++ b/sql/sql_show.cc 2008-12-18 07:30:35 +0000 @@ -5166,19 +5166,20 @@ static void store_schema_partitions_reco else table->field[23]->store(STRING_WITH_LEN("default"), cs); - table->field[24]->set_notnull(); if (part_elem->tablespace_name) + { + table->field[24]->set_notnull(); table->field[24]->store(part_elem->tablespace_name, strlen(part_elem->tablespace_name), cs); - else + } + } + if (!part_elem || !part_elem->tablespace_name) + { + const char *ts= showing_table->file->get_tablespace_name(); + if (ts) { - const char *ts= showing_table->file->get_tablespace_name(); - if(ts) - { - table->field[24]->store(ts, strlen(ts), cs); - } - else - table->field[24]->set_null(); + table->field[24]->set_notnull(); + table->field[24]->store(ts, strlen(ts), cs); } } return;