From: Date: April 22 2008 11:19am Subject: bk commit into 6.0 tree (svoj:1.2643) BUG#33213 List-Archive: http://lists.mysql.com/commits/45809 X-Bug: 33213 Message-Id: <20080422091910.4849841CECD@june.myoffice.izhnet.ru> 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-22 14:19:03+05:00, svoj@stripped +13 -0 BUG#33213 - Wrong CREATE TABLESPACE error when using existing DATAFILE Creating a tablespace with data file that already exist returns an error which states that the tablespace exist. With this fix error message states that the data file exist. include/my_base.h@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +2 -1 Added error code for "Tablespace data file exist" error. mysql-test/suite/falcon/r/falcon_bug_29511.result@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +1 -1 Expect proper error message when creating a tablespace with existing data file. mysql-test/suite/falcon/r/falcon_bug_33213.result@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +4 -0 A test case for BUG#33213. mysql-test/suite/falcon/r/falcon_bug_33213.result@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +0 -0 mysql-test/suite/falcon/t/falcon_bug_29511.test@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +1 -1 Expect proper error message when creating a tablespace with existing data file. mysql-test/suite/falcon/t/falcon_bug_33213.test@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +10 -0 A test case for BUG#33213. mysql-test/suite/falcon/t/falcon_bug_33213.test@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +0 -0 mysys/my_handler_errors.h@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +3 -1 Added error message for "Tablespace data file exist" error. sql/share/errmsg.txt@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +2 -0 Added error message for "Tablespace data file exist" error. sql/sql_tablespace.cc@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +4 -0 Added handling of HA_ERR_TABLESPACE_DATAFILE_EXIST error. storage/falcon/SQLException.h@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +2 -1 Added error code for "Tablespace data file exist" error. storage/falcon/StorageHandler.cpp@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +3 -0 Convert TABLESPACE_DATAFILE_EXIST_ERROR to StorageErrorTableSpaceDataFileExist. storage/falcon/StorageTableShare.h@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +2 -1 Added error code for "Tablespace data file exist" error. storage/falcon/TableSpaceManager.cpp@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +1 -1 Throw an exception with a proper error code. storage/falcon/ha_falcon.cpp@stripped, 2008-04-22 14:19:01+05:00, svoj@stripped +4 -0 Convert StorageErrorTableSpaceDataFileExist to HA_ERR_TABLESPACE_DATAFILE_EXIST. diff -Nrup a/include/my_base.h b/include/my_base.h --- a/include/my_base.h 2008-04-09 15:02:55 +05:00 +++ b/include/my_base.h 2008-04-22 14:19:01 +05:00 @@ -454,7 +454,8 @@ enum ha_base_keytype { #define HA_ERR_LOCK_OR_ACTIVE_TRANSACTION 177 #define HA_ERR_NO_SUCH_TABLESPACE 178 #define HA_ERR_TABLESPACE_NOT_EMPTY 179 -#define HA_ERR_LAST 179 /* Copy of last error nr */ +#define HA_ERR_TABLESPACE_DATAFILE_EXIST 180 +#define HA_ERR_LAST 180 /* Copy of last error nr */ /* Number of different errors */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) diff -Nrup a/mysql-test/suite/falcon/r/falcon_bug_29511.result b/mysql-test/suite/falcon/r/falcon_bug_29511.result --- a/mysql-test/suite/falcon/r/falcon_bug_29511.result 2008-03-11 22:53:44 +04:00 +++ b/mysql-test/suite/falcon/r/falcon_bug_29511.result 2008-04-22 14:19:01 +05:00 @@ -2,5 +2,5 @@ DROP TABLESPACE tablespace1 Engine Falcon; CREATE TABLESPACE tablespace1 ADD DATAFILE 'falcon_tablespace.fts' Engine Falcon; CREATE TABLESPACE tablespace2 ADD DATAFILE 'falcon_tablespace.fts' Engine Falcon; -ERROR HY000: Tablespace 'tablespace2' already exists +ERROR HY000: Tablespace data file 'falcon_tablespace.fts' already exists DROP TABLESPACE tablespace1 Engine Falcon; diff -Nrup a/mysql-test/suite/falcon/r/falcon_bug_33213.result b/mysql-test/suite/falcon/r/falcon_bug_33213.result --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/mysql-test/suite/falcon/r/falcon_bug_33213.result 2008-04-22 14:19:01 +05:00 @@ -0,0 +1,4 @@ +CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=Falcon; +CREATE TABLESPACE ts2 ADD DATAFILE 'ts1.fts' ENGINE=Falcon; +ERROR HY000: Tablespace data file 'ts1.fts' already exists +DROP TABLESPACE ts1 ENGINE=Falcon; diff -Nrup a/mysql-test/suite/falcon/t/falcon_bug_29511.test b/mysql-test/suite/falcon/t/falcon_bug_29511.test --- a/mysql-test/suite/falcon/t/falcon_bug_29511.test 2008-03-11 19:16:29 +04:00 +++ b/mysql-test/suite/falcon/t/falcon_bug_29511.test 2008-04-22 14:19:01 +05:00 @@ -18,7 +18,7 @@ CREATE TABLESPACE tablespace1 ADD DATAFI # ----------------------------------------------------- # # --- Test --- # # ----------------------------------------------------- # ---error ER_TABLESPACE_EXIST +--error ER_TABLESPACE_DATAFILE_EXIST CREATE TABLESPACE tablespace2 ADD DATAFILE 'falcon_tablespace.fts' Engine Falcon; # ----------------------------------------------------- # diff -Nrup a/mysql-test/suite/falcon/t/falcon_bug_33213.test b/mysql-test/suite/falcon/t/falcon_bug_33213.test --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/mysql-test/suite/falcon/t/falcon_bug_33213.test 2008-04-22 14:19:01 +05:00 @@ -0,0 +1,10 @@ +--source include/have_falcon.inc + +# +# BUG#33213 - Wrong CREATE TABLESPACE error when using existing DATAFILE +# + +CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=Falcon; +--error ER_TABLESPACE_DATAFILE_EXIST +CREATE TABLESPACE ts2 ADD DATAFILE 'ts1.fts' ENGINE=Falcon; +DROP TABLESPACE ts1 ENGINE=Falcon; diff -Nrup a/mysys/my_handler_errors.h b/mysys/my_handler_errors.h --- a/mysys/my_handler_errors.h 2008-04-09 15:02:55 +05:00 +++ b/mysys/my_handler_errors.h 2008-04-22 14:19:01 +05:00 @@ -126,6 +126,8 @@ static const char *handler_error_message /* HA_ERR_NO_SUCH_TABLESPACE */ "No such table space", /* TODO: get a better message */ /* HA_ERR_TABLESPACE_NOT_EMPTY */ - "Tablespace not empty" /* TODO: get a better message */ + "Tablespace not empty", /* TODO: get a better message */ + /* HA_ERR_TABLESPACE_DATAFILE_EXIST */ + "Tablespace data file already exists" /* TODO: get a better message */ }; diff -Nrup a/sql/share/errmsg.txt b/sql/share/errmsg.txt --- a/sql/share/errmsg.txt 2008-04-09 15:02:55 +05:00 +++ b/sql/share/errmsg.txt 2008-04-22 14:19:01 +05:00 @@ -6255,3 +6255,5 @@ ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE eng "The requested value for the heartbeat period %s %s" ER_TABLESPACE_NOT_EMPTY eng "Tablespace '%-.192s' not empty" +ER_TABLESPACE_DATAFILE_EXIST + eng "Tablespace data file '%-.192s' already exists" diff -Nrup a/sql/sql_tablespace.cc b/sql/sql_tablespace.cc --- a/sql/sql_tablespace.cc 2008-04-09 15:02:55 +05:00 +++ b/sql/sql_tablespace.cc 2008-04-22 14:19:01 +05:00 @@ -58,6 +58,10 @@ int mysql_alter_tablespace(THD *thd, st_ case HA_ERR_TABLESPACE_NOT_EMPTY: my_error(ER_TABLESPACE_NOT_EMPTY, MYF(0), ts_info->tablespace_name); break; + case HA_ERR_TABLESPACE_DATAFILE_EXIST: + my_error(ER_TABLESPACE_DATAFILE_EXIST, MYF(0), + ts_info->data_file_name); + break; default: my_error(error, MYF(0)); } diff -Nrup a/storage/falcon/SQLException.h b/storage/falcon/SQLException.h --- a/storage/falcon/SQLException.h 2008-03-11 19:16:31 +04:00 +++ b/storage/falcon/SQLException.h 2008-04-22 14:19:01 +05:00 @@ -68,7 +68,8 @@ enum SqlCode { TABLESPACE_NOT_EMPTY = -34, TABLESPACE_NOT_EXIST_ERROR = -35, DEVICE_FULL = -36, - FILE_ACCESS_ERROR = -37 + FILE_ACCESS_ERROR = -37, + TABLESPACE_DATAFILE_EXIST_ERROR = -38 }; class DllExport SQLException { diff -Nrup a/storage/falcon/StorageHandler.cpp b/storage/falcon/StorageHandler.cpp --- a/storage/falcon/StorageHandler.cpp 2008-04-09 04:40:08 +05:00 +++ b/storage/falcon/StorageHandler.cpp 2008-04-22 14:19:01 +05:00 @@ -514,6 +514,9 @@ int StorageHandler::createTablespace(con if (exception.getSqlcode() == TABLESPACE_NOT_EXIST_ERROR) return StorageErrorTableSpaceNotExist; + + if (exception.getSqlcode() == TABLESPACE_DATAFILE_EXIST_ERROR) + return StorageErrorTableSpaceDataFileExist; return StorageErrorTablesSpaceOperationFailed; } diff -Nrup a/storage/falcon/StorageTableShare.h b/storage/falcon/StorageTableShare.h --- a/storage/falcon/StorageTableShare.h 2007-12-03 01:11:57 +04:00 +++ b/storage/falcon/StorageTableShare.h 2008-04-22 14:19:01 +05:00 @@ -80,7 +80,8 @@ enum StorageError { StorageErrorTableSpaceExist = -107, StorageErrorTableNotEmpty = -108, StorageErrorTableSpaceNotExist = -109, - StorageErrorDeviceFull = -110 + StorageErrorDeviceFull = -110, + StorageErrorTableSpaceDataFileExist = -111 }; static const int StoreErrorIndexShift = 10; diff -Nrup a/storage/falcon/TableSpaceManager.cpp b/storage/falcon/TableSpaceManager.cpp --- a/storage/falcon/TableSpaceManager.cpp 2008-04-13 08:46:09 +05:00 +++ b/storage/falcon/TableSpaceManager.cpp 2008-04-22 14:19:01 +05:00 @@ -171,7 +171,7 @@ TableSpace* TableSpaceManager::createTab if (!repository && tableSpace->dbb->doesFileExist(fileName)) { delete tableSpace; - throw SQLError(TABLESPACE_EXIST_ERROR, "table space file name \"%s\" already exists\n", fileName); + throw SQLError(TABLESPACE_DATAFILE_EXIST_ERROR, "table space file name \"%s\" already exists\n", fileName); } try diff -Nrup a/storage/falcon/ha_falcon.cpp b/storage/falcon/ha_falcon.cpp --- a/storage/falcon/ha_falcon.cpp 2008-04-09 15:02:56 +05:00 +++ b/storage/falcon/ha_falcon.cpp 2008-04-22 14:19:01 +05:00 @@ -1820,6 +1820,10 @@ int StorageInterface::getMySqlError(int DBUG_PRINT("info", ("StorageErrorTableNotEmpty")); return HA_ERR_TABLESPACE_NOT_EMPTY; + case StorageErrorTableSpaceDataFileExist: + DBUG_PRINT("info", ("StorageErrorTableSpaceDataFileExist")); + return (HA_ERR_TABLESPACE_DATAFILE_EXIST); + default: DBUG_PRINT("info", ("Unknown Falcon Error")); return (200 - storageError);