#At file:///home/svoj/devel/bzr-mysql/mysql-6.0-falcon-team-bug35257/
2930 Sergey Vojtovich 2008-12-10
BUG#35257 - Falcon: tablespace names are case sensitive
Fixed that falcon tablespace names were case sensitive.
With this fix the rules for tablespace names are the same
as for table names, that is case insensitive.
Fixed by performing case up on tablespace name whenever
tablespace is created/dropped or a table is created/altered.
Note that it is incompatible fix:
- it is not possible to drop existing tablespace created
by previous versions, if it's name wasn't in upper case.
- it is not possible to create tables using tablespace
created by previous versions, if tablespace name wasn't
in upper case.
added:
mysql-test/suite/falcon/r/falcon_bug_35257.result
mysql-test/suite/falcon/t/falcon_bug_35257.test
modified:
storage/falcon/StorageHandler.cpp
storage/falcon/StorageTable.cpp
storage/falcon/StorageTable.h
storage/falcon/ha_falcon.cpp
per-file messages:
mysql-test/suite/falcon/r/falcon_bug_35257.result
A test case for BUG#35257.
mysql-test/suite/falcon/t/falcon_bug_35257.test
A test case for BUG#35257.
storage/falcon/StorageHandler.cpp
Upper case tablespace name when creating/dropping a tablespace.
storage/falcon/StorageTable.cpp
Added a method, which returns tablespace name in upper case.
storage/falcon/StorageTable.h
Added a method, which returns tablespace name in upper case.
storage/falcon/ha_falcon.cpp
Use upper case tablespace name when creating a table.
=== 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-01 22:18:34 +0000
+++ b/storage/falcon/ha_falcon.cpp 2008-12-10 13:25:17 +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 commit into mysql-6.0-falcon-team branch (svoj:2930) Bug#35257 | Sergey Vojtovich | 10 Dec |