From: kevin.lewis Date: February 10 2012 9:19pm Subject: bzr push into mysql-trunk branch (kevin.lewis:3878 to 3879) WL#6145 List-Archive: http://lists.mysql.com/commits/142830 Message-Id: <20120210211932.A100C1E01ED0@dhcp-adc-twvpn-2-vpnpool-10-154-54-29.vpn.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3879 kevin.lewis@stripped 2012-02-10 Testcases for WL#6145 added: mysql-test/r/archive_no_symlink.result mysql-test/r/archive_symlink.result mysql-test/t/archive_no_symlink-master.opt mysql-test/t/archive_no_symlink.test mysql-test/t/archive_symlink.test 3878 Jorgen Loland 2012-02-10 Bug#13627632 - INFORMATION SCHEMA TABLES DO NOT PACK LONG VARCHAR COLUMNS db_create_option needs HA_OPTION_PACK_RECORD to be set in order to create MyISAM tables with packed record format. When processing queries that access "normal" tables, temporary table fields are created in create_tmp_field_from_field(). On the other hand, queries against information_schema tables create fields for the temporary table in create_tmp_field_for_schema(). This patch aligns the two functions by setting db_create_options-flag HA_OPTION_PACK_RECORD when a VARCHAR column is added for schema temp tables just as is done for "normal" temp tables. The result is that temp tables for information schema queries use the packed MyISAM format if they contain sufficiently large VARCHAR columns. @ mysql-test/suite/opt_trace/r/temp_table.result Add test that I_S temporary tables use the packed MyISAM format @ mysql-test/suite/opt_trace/t/temp_table.test Add test that I_S temporary tables use the packed MyISAM format @ sql/sql_tmp_table.cc Set HA_OPTION_PACK_RECORD in create_tmp_field_for_schema() if a VARCHAR column is added. modified: mysql-test/suite/opt_trace/r/temp_table.result mysql-test/suite/opt_trace/t/temp_table.test sql/sql_tmp_table.cc === added file 'mysql-test/r/archive_no_symlink.result' --- a/mysql-test/r/archive_no_symlink.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/r/archive_no_symlink.result revid:kevin.lewis@stripped @@ -0,0 +1,26 @@ +# +# This test shows that DATA DIRECTORY and INDEX DIRECTORY are +# ignored where symbolic links are not supported such as Windows. +# +CREATE TABLE t1 ( +c1 int(10) unsigned NOT NULL AUTO_INCREMENT, +c2 varchar(30) NOT NULL, +c3 smallint(5) unsigned DEFAULT NULL, +PRIMARY KEY (c1)) +ENGINE = archive +DATA DIRECTORY = 'MYSQL_TMP_DIR/archive' INDEX DIRECTORY = 'MYSQL_TMP_DIR/archive'; +Warnings: +Warning 1618 option ignored +Warning 1618 option ignored +INSERT INTO t1 VALUES (NULL, "first", 1); +INSERT INTO t1 VALUES (NULL, "second", 2); +INSERT INTO t1 VALUES (NULL, "third", 3); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(10) unsigned NOT NULL AUTO_INCREMENT, + `c2` varchar(30) NOT NULL, + `c3` smallint(5) unsigned DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=ARCHIVE AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 +DROP TABLE t1; === added file 'mysql-test/r/archive_symlink.result' --- a/mysql-test/r/archive_symlink.result 1970-01-01 00:00:00 +0000 +++ b/mysql-test/r/archive_symlink.result revid:kevin.lewis@stripped @@ -0,0 +1,54 @@ +# +# Archive can only use an existing directory for DATA DIRECTORY. +# +CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30)) +ENGINE archive DATA DIRECTORY = 'MYSQL_TMP_DIR/archive' INDEX DIRECTORY = 'MYSQL_TMP_DIR/archive'; +ERROR HY000: Can't create table 'test.t1' (errno: 2) +# +# mkdir MYSQL_TMP_DIR/archive and try again... +# Archive will use a symlink for DATA DIRECTORY but ignore INDEX DIRECTORY. +# +CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30)) +ENGINE archive DATA DIRECTORY = 'MYSQL_TMP_DIR/archive' INDEX DIRECTORY = 'MYSQL_TMP_DIR/archive'; +Warnings: +Warning 1618 option ignored +INSERT INTO t1 VALUES (NULL, "blue"); +INSERT INTO t1 VALUES (NULL, "red"); +INSERT INTO t1 VALUES (NULL, "yellow"); +INSERT INTO t1 SELECT NULL, b FROM t1; +INSERT INTO t1 SELECT NULL, b FROM t1; +INSERT INTO t1 SELECT NULL, b FROM t1; +INSERT INTO t1 SELECT NULL, b FROM t1; +# Checking if archive file exists in DATA DIRECTORY +DROP TABLE t1; +# +# Be sure SQL MODE "NO_DIR_IN_CREATE" prevents the use of DATA DIRECTORY +# +SET @org_mode=@@sql_mode; +SET @@sql_mode='NO_DIR_IN_CREATE'; +SELECT @@sql_mode; +@@sql_mode +NO_DIR_IN_CREATE +CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30)) +ENGINE archive DATA DIRECTORY = 'MYSQL_TMP_DIR/archive'; +Warnings: +Warning 1618 option ignored +INSERT INTO t1 VALUES (NULL, "blue"); +INSERT INTO t1 VALUES (NULL, "red"); +INSERT INTO t1 VALUES (NULL, "yellow"); +# Checking if archive file exists in --datadir +DROP TABLE t1; +set @@sql_mode=@org_mode; +# +# MySQL engine does not allow DATA DIRECTORY to be +# within --datadir for any engine, including Archive +# +CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30)) +ENGINE archive DATA DIRECTORY 'MYSQLD_DATADIR/test'; +ERROR HY000: Incorrect arguments to DATA DIRECTORY +CREATE TABLE t1 (c1 int(10), PRIMARY KEY (c1)) +ENGINE archive INDEX DIRECTORY 'MYSQLD_DATADIR/test'; +ERROR HY000: Incorrect arguments to INDEX DIRECTORY +# +# Cleanup +# === added file 'mysql-test/t/archive_no_symlink-master.opt' --- a/mysql-test/t/archive_no_symlink-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/t/archive_no_symlink-master.opt revid:kevin.lewis@stripped @@ -0,0 +1 @@ +--skip-symbolic-links === added file 'mysql-test/t/archive_no_symlink.test' --- a/mysql-test/t/archive_no_symlink.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/t/archive_no_symlink.test revid:kevin.lewis@stripped @@ -0,0 +1,26 @@ +# Test archive engine when symbolic links are not available. +--source include/have_archive.inc + +--echo # +--echo # This test shows that DATA DIRECTORY and INDEX DIRECTORY are +--echo # ignored where symbolic links are not supported such as Windows. +--echo # + +let $data_directory = DATA DIRECTORY = '$MYSQL_TMP_DIR/archive'; +let $index_directory = INDEX DIRECTORY = '$MYSQL_TMP_DIR/archive'; + +--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR +eval CREATE TABLE t1 ( + c1 int(10) unsigned NOT NULL AUTO_INCREMENT, + c2 varchar(30) NOT NULL, + c3 smallint(5) unsigned DEFAULT NULL, + PRIMARY KEY (c1)) +ENGINE = archive +$data_directory $index_directory; + +INSERT INTO t1 VALUES (NULL, "first", 1); +INSERT INTO t1 VALUES (NULL, "second", 2); +INSERT INTO t1 VALUES (NULL, "third", 3); +SHOW CREATE TABLE t1; +DROP TABLE t1; + === added file 'mysql-test/t/archive_symlink.test' --- a/mysql-test/t/archive_symlink.test 1970-01-01 00:00:00 +0000 +++ b/mysql-test/t/archive_symlink.test revid:kevin.lewis@stripped @@ -0,0 +1,74 @@ +# Test archive engine when symbolic links are available. +--source include/not_windows.inc +--source include/have_archive.inc + +# DATA DIRECTORY/INDEX DIRECTORY require symbolic link support +--source include/have_symlink.inc + +let $MYSQLD_DATADIR= `select @@datadir`; +let $data_directory = DATA DIRECTORY = '$MYSQL_TMP_DIR/archive'; +let $index_directory = INDEX DIRECTORY = '$MYSQL_TMP_DIR/archive'; + +--echo # +--echo # Archive can only use an existing directory for DATA DIRECTORY. +--echo # +--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR +--error ER_CANT_CREATE_TABLE +eval CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30)) + ENGINE archive $data_directory $index_directory; + +--echo # +--echo # mkdir MYSQL_TMP_DIR/archive and try again... +--echo # Archive will use a symlink for DATA DIRECTORY but ignore INDEX DIRECTORY. +--echo # +--mkdir $MYSQL_TMP_DIR/archive +--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR +eval CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30)) + ENGINE archive $data_directory $index_directory; +INSERT INTO t1 VALUES (NULL, "blue"); +INSERT INTO t1 VALUES (NULL, "red"); +INSERT INTO t1 VALUES (NULL, "yellow"); +INSERT INTO t1 SELECT NULL, b FROM t1; +INSERT INTO t1 SELECT NULL, b FROM t1; +INSERT INTO t1 SELECT NULL, b FROM t1; +INSERT INTO t1 SELECT NULL, b FROM t1; +--echo # Checking if archive file exists in DATA DIRECTORY +--file_exists $MYSQL_TMP_DIR/archive/t1.ARZ +DROP TABLE t1; + +--echo # +--echo # Be sure SQL MODE "NO_DIR_IN_CREATE" prevents the use of DATA DIRECTORY +--echo # +SET @org_mode=@@sql_mode; +SET @@sql_mode='NO_DIR_IN_CREATE'; +SELECT @@sql_mode; +--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR +eval CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30)) + ENGINE archive $data_directory; +INSERT INTO t1 VALUES (NULL, "blue"); +INSERT INTO t1 VALUES (NULL, "red"); +INSERT INTO t1 VALUES (NULL, "yellow"); +--echo # Checking if archive file exists in --datadir +--file_exists $MYSQLD_DATADIR/test/t1.ARZ +DROP TABLE t1; +set @@sql_mode=@org_mode; + +--echo # +--echo # MySQL engine does not allow DATA DIRECTORY to be +--echo # within --datadir for any engine, including Archive +--echo # +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--error ER_WRONG_ARGUMENTS +eval CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30)) + ENGINE archive DATA DIRECTORY '$MYSQLD_DATADIR/test'; + +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--error ER_WRONG_ARGUMENTS +eval CREATE TABLE t1 (c1 int(10), PRIMARY KEY (c1)) +ENGINE archive INDEX DIRECTORY '$MYSQLD_DATADIR/test'; + +--echo # +--echo # Cleanup +--echo # +--rmdir $MYSQL_TMP_DIR/archive + No bundle (reason: useless for push emails).