MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:April 23 2008 8:21am
Subject:bk commit into 6.0 tree (svoj:1.2641) BUG#33397
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of svoj.  When svoj does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-04-23 13:21:28+05:00, svoj@stripped +6 -0
  BUG#33397 - ALTER TABLE into non-existing Falcon tablespace causes
              vague error.
  
  Creating or altering a table to non-existing tablespace returns
  non-informative error message.
  
  With this fix error message states that the tablespace doesn't
  exist.
  
  No test case needed for this fix - it is already covered by existing
  tests.

  mysql-test/suite/falcon/r/falcon_bug_34617.result@stripped, 2008-04-23 13:21:25+05:00, svoj@stripped +3 -3
    Updated a test case according to fix for BUG#33397.

  mysql-test/suite/falcon/t/falcon_bug_34617.test@stripped, 2008-04-23 13:21:25+05:00, svoj@stripped +3 -5
    Updated a test case according to fix for BUG#33397.

  sql/handler.cc@stripped, 2008-04-23 13:21:25+05:00, svoj@stripped +11 -4
    If create table fails due to non-existing tablespace, report
    appropriate error.

  storage/falcon/StorageDatabase.cpp@stripped, 2008-04-23 13:21:25+05:00, svoj@stripped +1 -1
    Let caller handle an exception.

  storage/falcon/StorageTableShare.cpp@stripped, 2008-04-23 13:21:25+05:00, svoj@stripped +16 -1
    Return proper error code for non-existing tablespace error.

  storage/falcon/TableSpaceManager.cpp@stripped, 2008-04-23 13:21:25+05:00, svoj@stripped +1 -1
    Throw an exception with proper error code.

diff -Nrup a/mysql-test/suite/falcon/r/falcon_bug_34617.result b/mysql-test/suite/falcon/r/falcon_bug_34617.result
--- a/mysql-test/suite/falcon/r/falcon_bug_34617.result	2008-04-16 13:54:50 +05:00
+++ b/mysql-test/suite/falcon/r/falcon_bug_34617.result	2008-04-23 13:21:25 +05:00
@@ -1,8 +1,8 @@
 CREATE TABLE t1(a INT) ENGINE=Falcon TABLESPACE nosuchtablespace;
-ERROR HY000: Can't create table 'test.t1' (errno: 156)
+ERROR HY000: Tablespace 'nosuchtablespace' doesn't exist
 CREATE TABLE t1(a INT) ENGINE=Falcon;
 ALTER TABLE t1 TABLESPACE nosuchtablespace;
-ERROR HY000: Can't create table 'test.#sql-temporary' (errno: 156)
+ERROR HY000: Tablespace 'nosuchtablespace' doesn't exist
 ALTER TABLE t1 TABLESPACE nosuchtablespace;
-ERROR HY000: Can't create table 'test.#sql-temporary' (errno: 156)
+ERROR HY000: Tablespace 'nosuchtablespace' doesn't exist
 DROP TABLE t1;
diff -Nrup a/mysql-test/suite/falcon/t/falcon_bug_34617.test b/mysql-test/suite/falcon/t/falcon_bug_34617.test
--- a/mysql-test/suite/falcon/t/falcon_bug_34617.test	2008-04-16 13:54:50 +05:00
+++ b/mysql-test/suite/falcon/t/falcon_bug_34617.test	2008-04-23 13:21:25 +05:00
@@ -6,13 +6,11 @@
 # BUG#34048 - Falcon: after error with tablespace, I can't create table
 # BUG#34617 - Falcon assertion in StorageHandler::addTable, line 622
 #
---error ER_CANT_CREATE_TABLE
+--error ER_NO_SUCH_TABLESPACE
 CREATE TABLE t1(a INT) ENGINE=Falcon TABLESPACE nosuchtablespace;
 CREATE TABLE t1(a INT) ENGINE=Falcon;
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
---error ER_CANT_CREATE_TABLE
+--error ER_NO_SUCH_TABLESPACE
 ALTER TABLE t1 TABLESPACE nosuchtablespace;
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
---error ER_CANT_CREATE_TABLE
+--error ER_NO_SUCH_TABLESPACE
 ALTER TABLE t1 TABLESPACE nosuchtablespace;
 DROP TABLE t1;
diff -Nrup a/sql/handler.cc b/sql/handler.cc
--- a/sql/handler.cc	2008-04-07 20:26:37 +05:00
+++ b/sql/handler.cc	2008-04-23 13:21:25 +05:00
@@ -3493,10 +3493,17 @@ int ha_create_table(THD *thd, const char
 
   error= table.file->ha_create(name, &table, create_info);
   VOID(closefrm(&table, 0));
-  if (error)
-  {
-    strxmov(name_buff, db, ".", table_name, NullS);
-    my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name_buff, error);
+  switch (error) {
+    case 0:
+      break;
+    case HA_ERR_NO_SUCH_TABLESPACE:
+      my_error(ER_NO_SUCH_TABLESPACE, MYF(0), create_info->tablespace);
+      break;
+    default:
+      strxmov(name_buff, db, ".", table_name, NullS);
+      my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name_buff,
+               error);
+      break;
   }
 err:
   free_table_share(&share);
diff -Nrup a/storage/falcon/StorageDatabase.cpp b/storage/falcon/StorageDatabase.cpp
--- a/storage/falcon/StorageDatabase.cpp	2008-04-06 03:09:14 +05:00
+++ b/storage/falcon/StorageDatabase.cpp	2008-04-23 13:21:25 +05:00
@@ -210,7 +210,7 @@ Table* StorageDatabase::createTable(Stor
 		statement->release();
 		storageConnection->setErrorText(&exception);
 		
-		return NULL;
+		throw;
 		}
 		
 	return findTable(tableName, schemaName);
diff -Nrup a/storage/falcon/StorageTableShare.cpp b/storage/falcon/StorageTableShare.cpp
--- a/storage/falcon/StorageTableShare.cpp	2008-04-16 13:54:50 +05:00
+++ b/storage/falcon/StorageTableShare.cpp	2008-04-23 13:21:25 +05:00
@@ -124,7 +124,22 @@ int StorageTableShare::open(void)
 
 int StorageTableShare::create(StorageConnection *storageConnection, const char* sql, int64 autoIncrementValue)
 {
-	if (!(table = storageDatabase->createTable(storageConnection, name, schemaName, sql, autoIncrementValue)))
+	try
+		{
+		table = storageDatabase->createTable(storageConnection, name, schemaName, sql, autoIncrementValue);
+		}
+	catch (SQLException& exception)
+		{
+		int sqlcode= exception.getSqlcode();
+		switch (sqlcode)
+			{
+			case TABLESPACE_NOT_EXIST_ERROR:
+				return StorageErrorTableSpaceNotExist;
+			default:
+				return StorageErrorTableExits;
+			}
+		}
+	if (!table)
 		return StorageErrorTableExits;
 	
 	if (autoIncrementValue)
diff -Nrup a/storage/falcon/TableSpaceManager.cpp b/storage/falcon/TableSpaceManager.cpp
--- a/storage/falcon/TableSpaceManager.cpp	2008-04-22 14:19:01 +05:00
+++ b/storage/falcon/TableSpaceManager.cpp	2008-04-23 13:21:25 +05:00
@@ -150,7 +150,7 @@ TableSpace* TableSpaceManager::getTableS
 	TableSpace *tableSpace = findTableSpace(name);
 
 	if (!tableSpace)
-		throw SQLError(DDL_ERROR, "can't find table space \"%s\"", name);
+		throw SQLError(TABLESPACE_NOT_EXIST_ERROR, "can't find table space \"%s\"", name);
 
 	if (!tableSpace->active)
 		throw SQLError(RUNTIME_ERROR, "table space \"%s\" is not active", (const char*) tableSpace->name);
Thread
bk commit into 6.0 tree (svoj:1.2641) BUG#33397Sergey Vojtovich23 Apr