From: Date: December 15 2008 9:38am Subject: bzr push into mysql-6.0-falcon-team branch (svoj:2933 to 2934) Bug#32398 List-Archive: http://lists.mysql.com/commits/61649 X-Bug: 32398 Message-Id: <20081215083829.8804041CED0@june.myoffice.izhnet.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT 2934 Sergey Vojtovich 2008-12-15 BUG#32398 - Falcon: tablespace file can be table file It was possible to create Falcon tablespace data files in MySQL database directory with potential MyISAM/partitioning index/data file names. Later MyISAM/partitioning may silently overwrite Falcon tablespace data file. E.g.: CREATE TABLESPACE ts1 ADD DATAFILE 'test/t1.MYD' ENGINE=Falcon; CREATE TABLE test.t1(a INT) ENGINE=MyISAM; The second statement overwrites Falcon tablespace file. The original patch for this bug was commented out some time ago - it caused some problems and was considered to be incorrect. With this fix, when creating Falcon tablespace, we append '.fts' extention to it's data file name if the provided name doesn't end up with '.fts' already. modified: mysql-test/suite/falcon/r/falcon_bug_32398.result mysql-test/suite/falcon/t/disabled.def mysql-test/suite/falcon/t/falcon_bug_32398.test storage/falcon/ha_falcon.cpp 2933 Sergey Vojtovich 2008-12-11 BUG#33583 - Falcon memory parameters on 32bit system can be set > 4GB Fixed that falcon_page_cache_size can be set to value bigger than maximum addressable memory. With this fix, if falcon_page_cache_size is set to bigger than maximum addressable memory, it's value is adjusted to maximum addressable memory and a warning is issued to the error log. modified: storage/falcon/ha_falcon.cpp === modified file 'mysql-test/suite/falcon/r/falcon_bug_32398.result' --- a/mysql-test/suite/falcon/r/falcon_bug_32398.result 2008-04-10 11:28:11 +0000 +++ b/mysql-test/suite/falcon/r/falcon_bug_32398.result 2008-12-15 08:36:44 +0000 @@ -1,7 +1,20 @@ -CREATE TABLESPACE ts1 ADD DATAFILE 'test/ts1.fts' ENGINE=falcon; -ERROR HY000: Incorrect arguments to DATAFILE -CREATE TABLESPACE ts1 ADD DATAFILE 'TEST_DIR/master-data/test/ts1.fts' -ENGINE=falcon; -ERROR HY000: Incorrect arguments to DATAFILE -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=falcon; -DROP TABLESPACE ts1 ENGINE=falcon; +*** Bug #32398 *** +SET @@storage_engine = 'Falcon'; +CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=Falcon; +CREATE TABLESPACE ts2 ADD DATAFILE 'ts2.MYD' ENGINE=Falcon; +CREATE TABLESPACE ts3 ADD DATAFILE 'ts3' ENGINE=Falcon; +CREATE TABLESPACE ts4 ADD DATAFILE 'ts4test' ENGINE=Falcon; +CREATE TABLESPACE ts5 ADD DATAFILE '' ENGINE=Falcon; +ERROR HY000: Malformed file path '' +SELECT TABLESPACE_NAME, FILE_NAME FROM INFORMATION_SCHEMA.FILES; +TABLESPACE_NAME FILE_NAME +FALCON_USER falcon_user.fts +FALCON_TEMPORARY falcon_temporary.fts +ts1 ts1.fts +ts2 ts2.MYD.fts +ts3 ts3.fts +ts4 ts4test.fts +DROP TABLESPACE ts1 ENGINE=Falcon; +DROP TABLESPACE ts2 ENGINE=Falcon; +DROP TABLESPACE ts3 ENGINE=Falcon; +DROP TABLESPACE ts4 ENGINE=Falcon; === modified file 'mysql-test/suite/falcon/t/disabled.def' --- a/mysql-test/suite/falcon/t/disabled.def 2008-12-10 16:55:09 +0000 +++ b/mysql-test/suite/falcon/t/disabled.def 2008-12-15 08:36:44 +0000 @@ -10,5 +10,4 @@ # ############################################################################## -falcon_bug_32398 : Bug#32398 2008-08-28 HF HF disabled until new fix for this bug is developed falcon_bug_28095 : Bug#40636 2008-12-10 hky Disabled until soft server restart works reliable === modified file 'mysql-test/suite/falcon/t/falcon_bug_32398.test' --- a/mysql-test/suite/falcon/t/falcon_bug_32398.test 2008-04-10 11:28:11 +0000 +++ b/mysql-test/suite/falcon/t/falcon_bug_32398.test 2008-12-15 08:36:44 +0000 @@ -1,14 +1,35 @@ --source include/have_falcon.inc # -# BUG#32398 - Falcon: tablespace file can be table file +# Bug #32398: Falcon: tablespace file can be table file # -#CREATE TABLE t1(a INT) DATA DIRECTORY='mysql'; ---error ER_WRONG_ARGUMENTS -CREATE TABLESPACE ts1 ADD DATAFILE 'test/ts1.fts' ENGINE=falcon; ---replace_result $MYSQLTEST_VARDIR TEST_DIR ---error ER_WRONG_ARGUMENTS -eval CREATE TABLESPACE ts1 ADD DATAFILE '$MYSQLTEST_VARDIR/master-data/test/ts1.fts' -ENGINE=falcon; -CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=falcon; -DROP TABLESPACE ts1 ENGINE=falcon; +--echo *** Bug #32398 *** + +# ----------------------------------------------------- # +# --- Initialisation --- # +# ----------------------------------------------------- # +let $engine = 'Falcon'; +eval SET @@storage_engine = $engine; + +# ----------------------------------------------------- # +# --- Test --- # +# ----------------------------------------------------- # +CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=Falcon; +CREATE TABLESPACE ts2 ADD DATAFILE 'ts2.MYD' ENGINE=Falcon; +CREATE TABLESPACE ts3 ADD DATAFILE 'ts3' ENGINE=Falcon; +CREATE TABLESPACE ts4 ADD DATAFILE 'ts4test' ENGINE=Falcon; +--error ER_BAD_PATH +CREATE TABLESPACE ts5 ADD DATAFILE '' ENGINE=Falcon; + +# ----------------------------------------------------- # +# --- Check --- # +# ----------------------------------------------------- # +SELECT TABLESPACE_NAME, FILE_NAME FROM INFORMATION_SCHEMA.FILES; + +# ----------------------------------------------------- # +# --- Final cleanup --- # +# ----------------------------------------------------- # +DROP TABLESPACE ts1 ENGINE=Falcon; +DROP TABLESPACE ts2 ENGINE=Falcon; +DROP TABLESPACE ts3 ENGINE=Falcon; +DROP TABLESPACE ts4 ENGINE=Falcon; === modified file 'storage/falcon/ha_falcon.cpp' --- a/storage/falcon/ha_falcon.cpp 2008-12-11 12:28:15 +0000 +++ b/storage/falcon/ha_falcon.cpp 2008-12-15 08:36:44 +0000 @@ -2105,7 +2105,8 @@ int StorageInterface::alter_tablespace(h { DBUG_ENTER("NfsStorageEngine::alter_tablespace"); int ret = 0; - + const char *data_file_name= ts_info->data_file_name; + char buff[FN_REFLEN]; /* CREATE TABLESPACE tablespace ADD DATAFILE 'file' @@ -2125,28 +2126,30 @@ int StorageInterface::alter_tablespace(h for NDB only. */ - /* - Sergey Vojtovich is to reconsider this code - - if (ts_info->data_file_name) + if (data_file_name) { - char buff[FN_REFLEN]; - size_t dirname_part_length; - dirname_part(buff, ts_info->data_file_name, &dirname_part_length); - fn_format(buff, buff, mysql_real_data_home, "", - MY_RELATIVE_PATH | MY_UNPACK_FILENAME); - if (test_if_data_home_dir(buff)) + size_t length= strlen(data_file_name); + if (length <= 4 || strcmp(data_file_name + length - 4, ".fts")) { - my_error(ER_WRONG_ARGUMENTS, MYF(0), "DATAFILE"); - DBUG_RETURN(1); + if (!length || length > FN_REFLEN - 5) + { + my_error(ER_BAD_PATH, MYF(0), data_file_name); + DBUG_RETURN(1); + } + memcpy(buff, data_file_name, length); + buff[length]= '.'; + buff[length + 1]= 'f'; + buff[length + 2]= 't'; + buff[length + 3]= 's'; + buff[length + 4]= '\0'; + data_file_name= buff; } } - */ switch (ts_info->ts_cmd_type) { case CREATE_TABLESPACE: - ret = storageHandler->createTablespace( ts_info->tablespace_name, ts_info->data_file_name, ts_info->ts_comment); + ret = storageHandler->createTablespace( ts_info->tablespace_name, data_file_name, ts_info->ts_comment); break; case DROP_TABLESPACE: