List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:December 12 2008 9:04am
Subject:bzr commit into mysql-6.0-falcon-team branch (svoj:2934) Bug#32398
View as plain text  
#At file:///home/svoj/devel/bzr-mysql/mysql-6.0-falcon-team-bug32398/

 2934 Sergey Vojtovich	2008-12-12
      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/partiotioning 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);
      
      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

per-file messages:
  mysql-test/suite/falcon/r/falcon_bug_32398.result
    Updated test result.
  mysql-test/suite/falcon/t/disabled.def
    Re-enabled falcon_bug_32398.
  mysql-test/suite/falcon/t/falcon_bug_32398.test
    Updated a test case.
  storage/falcon/ha_falcon.cpp
    Reverted original (was already commented out) fix for BUG#32398.
    
    Append '.fts' extention to tablespace data file name if the name
    doesn't have it.
=== 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-12 09:04:13 +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-12 09:04:13 +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-12 09:04:13 +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-12 09:04:13 +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:

Thread
bzr commit into mysql-6.0-falcon-team branch (svoj:2934) Bug#32398Sergey Vojtovich12 Dec
  • RE: bzr commit into mysql-6.0-falcon-team branch (svoj:2934) Bug#32398Vladislav Vaintroub12 Dec