List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:November 13 2007 10:57am
Subject:bk commit into 6.0 tree (svoj:1.2671) BUG#31114
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, 2007-11-13 13:56:56+04:00, svoj@stripped +10 -0
  BUG#31114 - falcon : creating tablespace with same name twice returns
              Unknown error -103
  
  When creating a tablespace that already exists, falcon returns
  non-informative error message.

  include/my_base.h@stripped, 2007-11-13 13:56:54+04:00, svoj@stripped +2 -1
    Added error code for "tablespace already exist" error.

  mysql-test/suite/falcon/r/falcon_ts.result@stripped, 2007-11-13 13:56:54+04:00,
svoj@stripped +4 -0
    A test case for BUG#31114.

  mysql-test/suite/falcon/t/falcon_ts.test@stripped, 2007-11-13 13:56:54+04:00, svoj@stripped
+9 -0
    A test case for BUG#31114.

  sql/share/errmsg.txt@stripped, 2007-11-13 13:56:54+04:00, svoj@stripped +2 -0
    Added "tablespace already exist" message.

  sql/sql_tablespace.cc@stripped, 2007-11-13 13:56:54+04:00, svoj@stripped +11 -11
    Added handling of HA_ERR_TABLESPACE_EXIST error.

  storage/falcon/SQLException.h@stripped, 2007-11-13 13:56:54+04:00, svoj@stripped +2 -1
    Added error code for "tablespace already exist" error.

  storage/falcon/Statement.cpp@stripped, 2007-11-13 13:56:54+04:00, svoj@stripped +1 -1
    Throw "tablespace already exists" error using appropriate error code.

  storage/falcon/StorageHandler.cpp@stripped, 2007-11-13 13:56:54+04:00, svoj@stripped +3 -1
    Check if TableSpaceManager got "tablespace already exists" error and
    return appropriate error code in this case.

  storage/falcon/StorageTableShare.h@stripped, 2007-11-13 13:56:54+04:00, svoj@stripped +2 -1
    Added error code for "tablespace already exist" error.

  storage/falcon/ha_falcon.cpp@stripped, 2007-11-13 13:56:54+04:00, svoj@stripped +2 -0
    Check if StorageHandler got "tablespace already exists" error and
    return appropriate error code in this case.

diff -Nrup a/include/my_base.h b/include/my_base.h
--- a/include/my_base.h	2007-08-27 12:05:23 +05:00
+++ b/include/my_base.h	2007-11-13 13:56:54 +04:00
@@ -418,7 +418,8 @@ enum ha_base_keytype {
 
 #define HA_ERR_LOGGING_IMPOSSIBLE 170 /* It is not possible to log this
                                          statement */
-#define HA_ERR_LAST              170 /*Copy last error nr.*/
+#define HA_ERR_TABLESPACE_EXIST 171
+#define HA_ERR_LAST              171 /*Copy last error nr.*/
 /* Add error numbers before HA_ERR_LAST and change it accordingly. */
 #define HA_ERR_ERRORS            (HA_ERR_LAST - HA_ERR_FIRST + 1)
 
diff -Nrup a/mysql-test/suite/falcon/r/falcon_ts.result
b/mysql-test/suite/falcon/r/falcon_ts.result
--- a/mysql-test/suite/falcon/r/falcon_ts.result	2007-11-13 13:38:27 +04:00
+++ b/mysql-test/suite/falcon/r/falcon_ts.result	2007-11-13 13:56:54 +04:00
@@ -1,2 +1,6 @@
 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=MyISAM;
 ERROR HY000: Table storage engine 'MyISAM' does not support the create option 'TABLESPACE
or LOGFILE GROUP'
+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;
diff -Nrup a/mysql-test/suite/falcon/t/falcon_ts.test
b/mysql-test/suite/falcon/t/falcon_ts.test
--- a/mysql-test/suite/falcon/t/falcon_ts.test	2007-11-13 13:38:27 +04:00
+++ b/mysql-test/suite/falcon/t/falcon_ts.test	2007-11-13 13:56:54 +04:00
@@ -5,3 +5,12 @@
 #
 --error 1477
 CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=MyISAM;
+
+#
+# BUG#31114 - falcon : creating tablespace with same name twice returns
+#             Unknown error -103
+#
+CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=falcon;
+--error 1655
+CREATE TABLESPACE ts1 ADD DATAFILE 'ts2.fts' ENGINE=falcon;
+DROP TABLESPACE ts1 ENGINE=falcon;
diff -Nrup a/sql/share/errmsg.txt b/sql/share/errmsg.txt
--- a/sql/share/errmsg.txt	2007-10-20 01:20:01 +05:00
+++ b/sql/share/errmsg.txt	2007-11-13 13:56:54 +04:00
@@ -6218,3 +6218,5 @@ ER_TRG_CANT_OPEN_TABLE
 
 ER_CANT_CREATE_SROUTINE
   eng "Cannot create stored routine `%-.64s`. Check warnings"
+ER_TABLESPACE_EXIST
+  eng "Tablespace '%-.192s' already exists"
diff -Nrup a/sql/sql_tablespace.cc b/sql/sql_tablespace.cc
--- a/sql/sql_tablespace.cc	2007-11-13 13:38:27 +04:00
+++ b/sql/sql_tablespace.cc	2007-11-13 13:56:54 +04:00
@@ -43,17 +43,17 @@ int mysql_alter_tablespace(THD *thd, st_
   {
     if ((error= hton->alter_tablespace(hton, thd, ts_info)))
     {
-      if (error == HA_ADMIN_NOT_IMPLEMENTED)
-      {
-        my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "");
-      }
-      else if (error == 1)
-      {
-        DBUG_RETURN(1);
-      }
-      else
-      {
-        my_error(error, MYF(0));
+      switch (error) {
+        case 1:
+          DBUG_RETURN(1);
+        case HA_ADMIN_NOT_IMPLEMENTED:
+          my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "");
+          break;
+        case HA_ERR_TABLESPACE_EXIST:
+          my_error(ER_TABLESPACE_EXIST, MYF(0), ts_info->tablespace_name);
+          break;
+        default:
+          my_error(error, MYF(0));
       }
       DBUG_RETURN(error);
     }
diff -Nrup a/storage/falcon/SQLException.h b/storage/falcon/SQLException.h
--- a/storage/falcon/SQLException.h	2007-11-03 09:33:52 +04:00
+++ b/storage/falcon/SQLException.h	2007-11-13 13:56:54 +04:00
@@ -63,7 +63,8 @@ enum SqlCode {
 	DEADLOCK					= -29,
 	OUT_OF_MEMORY_ERROR			= -30,
 	OUT_OF_RECORD_MEMORY_ERROR	= -31,
-	LOCK_TIMEOUT				= -32
+	LOCK_TIMEOUT				= -32,
+	DDL_TABLESPACE_EXIST_ERROR		= -33
 	};
 
 class DllExport SQLException {
diff -Nrup a/storage/falcon/Statement.cpp b/storage/falcon/Statement.cpp
--- a/storage/falcon/Statement.cpp	2007-11-06 03:47:41 +04:00
+++ b/storage/falcon/Statement.cpp	2007-11-13 13:56:54 +04:00
@@ -2924,7 +2924,7 @@ void Statement::createTableSpace(Syntax 
 	if (tableSpace)
 		{
 		if (syntax->type == nod_create_tablespace)
-			throw SQLError(DDL_ERROR, "tablespace \"%s\" already exists", name);
+			throw SQLError(DDL_TABLESPACE_EXIST_ERROR, "tablespace \"%s\" already exists", name);
 		
 		if (syntax->type == nod_upgrade_tablespace)
 			{
diff -Nrup a/storage/falcon/StorageHandler.cpp b/storage/falcon/StorageHandler.cpp
--- a/storage/falcon/StorageHandler.cpp	2007-11-13 03:12:49 +04:00
+++ b/storage/falcon/StorageHandler.cpp	2007-11-13 13:56:54 +04:00
@@ -454,8 +454,10 @@ int StorageHandler::createTablespace(con
 		statement->executeUpdate(gen.getString());
 		statement->close();
 		}
-	catch (SQLException&)
+	catch (SQLException& exception)
 		{
+                if (exception.getSqlcode() == DDL_TABLESPACE_EXIST_ERROR)
+			return StorageErrorTableSpaceExist;
 		return StorageErrorTablesSpaceOperationFailed;
 		}
 	
diff -Nrup a/storage/falcon/StorageTableShare.h b/storage/falcon/StorageTableShare.h
--- a/storage/falcon/StorageTableShare.h	2007-11-03 09:33:58 +04:00
+++ b/storage/falcon/StorageTableShare.h	2007-11-13 13:56:54 +04:00
@@ -75,7 +75,8 @@ enum StorageError {
 	StorageErrorTablesSpaceOperationFailed = -103,
 	StorageErrorOutOfMemory			= -104,		// memory pool limit reached or system memory
exhausted
 	StorageErrorOutOfRecordMemory	= -105,		// memory pool limit reached or system memory
exhausted
-	StorageErrorLockTimeout			= -106
+	StorageErrorLockTimeout			= -106,
+	StorageErrorTableSpaceExist		= -107
 	};
 	
 static const int StoreErrorIndexShift	= 10;
diff -Nrup a/storage/falcon/ha_falcon.cpp b/storage/falcon/ha_falcon.cpp
--- a/storage/falcon/ha_falcon.cpp	2007-11-13 03:52:12 +04:00
+++ b/storage/falcon/ha_falcon.cpp	2007-11-13 13:56:54 +04:00
@@ -1796,6 +1796,8 @@ int StorageInterface::alter_tablespace(h
 		{
 		case CREATE_TABLESPACE:
 			ret = storageHandler->createTablespace(ts_info->tablespace_name,
ts_info->data_file_name);
+			if (ret == StorageErrorTableSpaceExist)
+				ret= HA_ERR_TABLESPACE_EXIST;
 			break;
 
 		case DROP_TABLESPACE:
Thread
bk commit into 6.0 tree (svoj:1.2671) BUG#31114Sergey Vojtovich13 Nov