2935 Sergey Vojtovich 2008-12-16 [merge]
Merge.
added:
mysql-test/suite/falcon/r/falcon_bug_35257.result
mysql-test/suite/falcon/t/falcon_bug_35257.test
modified:
mysql-test/suite/falcon/r/falcon_bug_32398.result
storage/falcon/StorageHandler.cpp
storage/falcon/StorageTable.cpp
storage/falcon/StorageTable.h
storage/falcon/ha_falcon.cpp
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
=== modified file 'mysql-test/suite/falcon/r/falcon_bug_32398.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_32398.result 2008-12-15 08:36:44 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_32398.result 2008-12-16 10:30:25 +0000
@@ -10,10 +10,10 @@ SELECT TABLESPACE_NAME, FILE_NAME FROM I
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
+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;
=== added file 'mysql-test/suite/falcon/r/falcon_bug_35257.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_35257.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_35257.result 2008-12-10 13:25:17 +0000
@@ -0,0 +1,6 @@
+*** Bug #35257 ***
+SET @@storage_engine = 'Falcon';
+CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=Falcon;
+CREATE TABLESPACE TS1 ADD DATAFILE 'ts2.fts' ENGINE=Falcon;
+ERROR HY000: Tablespace 'TS1' already exists
+DROP TABLESPACE ts1 ENGINE=Falcon;
=== added file 'mysql-test/suite/falcon/t/falcon_bug_35257.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_35257.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_35257.test 2008-12-10 13:25:17 +0000
@@ -0,0 +1,28 @@
+--source include/have_falcon.inc
+
+#
+# Bug #35257: Falcon: tablespace names are case sensitive
+#
+--echo *** Bug #35257 ***
+
+# ----------------------------------------------------- #
+# --- Initialisation --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+# ----------------------------------------------------- #
+# --- Test --- #
+# ----------------------------------------------------- #
+CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=Falcon;
+--error ER_TABLESPACE_EXIST
+CREATE TABLESPACE TS1 ADD DATAFILE 'ts2.fts' ENGINE=Falcon;
+
+# ----------------------------------------------------- #
+# --- Check --- #
+# ----------------------------------------------------- #
+
+# ----------------------------------------------------- #
+# --- Final cleanup --- #
+# ----------------------------------------------------- #
+DROP TABLESPACE ts1 ENGINE=Falcon;
=== modified file 'storage/falcon/StorageHandler.cpp'
--- a/storage/falcon/StorageHandler.cpp 2008-11-13 13:27:13 +0000
+++ b/storage/falcon/StorageHandler.cpp 2008-12-10 13:25:17 +0000
@@ -506,7 +506,8 @@ int StorageHandler::createTablespace(con
try
{
- JString cmd = genCreateTableSpace(tableSpaceName, filename, comment);
+ JString tableSpace= JString::upcase(tableSpaceName);
+ JString cmd = genCreateTableSpace(tableSpace, filename, comment);
Sync sync(&dictionarySyncObject, "StorageHandler::createTablespace");
sync.lock(Exclusive);
Statement *statement = dictionaryConnection->createStatement();
@@ -547,8 +548,9 @@ int StorageHandler::deleteTablespace(con
try
{
+ JString tableSpace= JString::upcase(tableSpaceName);
CmdGen gen;
- gen.gen("drop tablespace \"%s\"", tableSpaceName);
+ gen.gen("drop tablespace \"%s\"", (const char*) tableSpace);
Sync sync(&dictionarySyncObject, "StorageHandler::deleteTablespace");
sync.lock(Exclusive);
Statement *statement = dictionaryConnection->createStatement();
=== modified file 'storage/falcon/StorageTable.cpp'
--- a/storage/falcon/StorageTable.cpp 2008-12-04 11:00:12 +0000
+++ b/storage/falcon/StorageTable.cpp 2008-12-10 13:25:17 +0000
@@ -375,6 +375,11 @@ const char* StorageTable::getSchemaName(
return share->schemaName;
}
+const char* StorageTable::getTableSpaceName(void)
+{
+ return share->tableSpace;
+}
+
void StorageTable::setConnection(StorageConnection* newStorageConn)
{
if (bitmap)
=== modified file 'storage/falcon/StorageTable.h'
--- a/storage/falcon/StorageTable.h 2008-10-22 20:44:09 +0000
+++ b/storage/falcon/StorageTable.h 2008-12-10 13:25:17 +0000
@@ -99,6 +99,7 @@ public:
virtual const unsigned char* getEncoding(int fieldIndex);
virtual const char* getName(void);
virtual const char* getSchemaName(void);
+ virtual const char* getTableSpaceName(void);
virtual int compareKey(const unsigned char* key, int keyLength);
virtual int translateError(SQLException *exception, int defaultStorageError);
virtual int isKeyNull(const unsigned char* key, int keyLength);
=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp 2008-12-15 08:36:44 +0000
+++ b/storage/falcon/ha_falcon.cpp 2008-12-16 10:30:25 +0000
@@ -859,7 +859,7 @@ int StorageInterface::create(const char
tableSpace = TEMPORARY_TABLESPACE;
}
else if (info->tablespace)
- tableSpace = info->tablespace;
+ tableSpace = storageTable->getTableSpaceName();
else
tableSpace = DEFAULT_TABLESPACE;
| Thread |
|---|
| • bzr push into mysql-6.0-falcon-team branch (svoj:2934 to 2935) | Sergey Vojtovich | 16 Dec |