Sergey,
I'm not sure why you have_ts_command_type[0]="UNKNOWN" because you don't
use it. Instead, the code uses TS_CMD_NOT_DEFINED
> + if (ts_cmd_type < -1 || ts_cmd_type > 7)
> + ts_cmd_type= TS_CMD_NOT_DEFINED;
I like the forward thinking design of str_ts_command_type. Are any of
the other strings used by this? If so, should the testcase be expanded
to show them?
Please have a server engineer validate these changes besides me.
Kevin
Sergey Vojtovich wrote:
> #At file:///home/svoj/devel/bzr-mysql/mysql-6.0-falcon-team-bug41548/
>
> 2953 Sergey Vojtovich 2008-12-25
> BUG#41548 - ALTER TABLESPACE does not work.
>
> Vague error message was returned when an engine doesn't
> support some specific tablespace command.
> added:
> mysql-test/suite/falcon/r/falcon_bug_41548.result
> mysql-test/suite/falcon/t/falcon_bug_41548.test
> modified:
> sql/share/errmsg.txt
> sql/sql_tablespace.cc
>
> per-file messages:
> mysql-test/suite/falcon/r/falcon_bug_41548.result
> A test case for BUG#41548.
> mysql-test/suite/falcon/t/falcon_bug_41548.test
> A test case for BUG#41548.
> sql/share/errmsg.txt
> Added an error message.
> sql/sql_tablespace.cc
> Return better error message if an engine
> doesn't support this tablespace command.
> === added file 'mysql-test/suite/falcon/r/falcon_bug_41548.result'
> --- a/mysql-test/suite/falcon/r/falcon_bug_41548.result 1970-01-01 00:00:00 +0000
> +++ b/mysql-test/suite/falcon/r/falcon_bug_41548.result 2008-12-25 12:51:14 +0000
> @@ -0,0 +1,6 @@
> +*** Bug #41548 ***
> +SET @@storage_engine = 'Falcon';
> +CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=Falcon;
> +ALTER TABLESPACE ts1 ADD DATAFILE 'ts2.fts' ENGINE=Falcon;
> +ERROR HY000: Falcon doesn't support ALTER TABLESPACE
> +DROP TABLESPACE ts1 ENGINE=Falcon;
>
> === added file 'mysql-test/suite/falcon/t/falcon_bug_41548.test'
> --- a/mysql-test/suite/falcon/t/falcon_bug_41548.test 1970-01-01 00:00:00 +0000
> +++ b/mysql-test/suite/falcon/t/falcon_bug_41548.test 2008-12-25 12:51:14 +0000
> @@ -0,0 +1,28 @@
> +--source include/have_falcon.inc
> +
> +#
> +# Bug #41548: ALTER TABLESPACE does not work.
> +#
> +--echo *** Bug #41548 ***
> +
> +# ----------------------------------------------------- #
> +# --- Initialisation --- #
> +# ----------------------------------------------------- #
> +let $engine = 'Falcon';
> +eval SET @@storage_engine = $engine;
> +
> +# ----------------------------------------------------- #
> +# --- Test --- #
> +# ----------------------------------------------------- #
> +CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.fts' ENGINE=Falcon;
> +--error ER_COM_UNSUPPORTED
> +ALTER TABLESPACE ts1 ADD DATAFILE 'ts2.fts' ENGINE=Falcon;
> +
> +# ----------------------------------------------------- #
> +# --- Check --- #
> +# ----------------------------------------------------- #
> +
> +# ----------------------------------------------------- #
> +# --- Final cleanup --- #
> +# ----------------------------------------------------- #
> +DROP TABLESPACE ts1 ENGINE=Falcon;
>
> === modified file 'sql/share/errmsg.txt'
> --- a/sql/share/errmsg.txt 2008-12-14 11:36:15 +0000
> +++ b/sql/share/errmsg.txt 2008-12-25 12:51:14 +0000
> @@ -6450,3 +6450,5 @@ ER_BACKUP_RESTORE_DBS
>
> ER_WARN_ENGINE_TRANSACTION_ROLLBACK
> eng "Storage engine %s does not support rollback for this statement. Transaction
> rolled back and must be restarted"
> +ER_COM_UNSUPPORTED
> + eng "%s doesn't support %s"
>
> === modified file 'sql/sql_tablespace.cc'
> --- a/sql/sql_tablespace.cc 2008-07-14 12:49:19 +0000
> +++ b/sql/sql_tablespace.cc 2008-12-25 12:51:14 +0000
> @@ -17,6 +17,29 @@
>
> #include "mysql_priv.h"
>
> +
> +static const char *str_ts_command_type[]=
> +{
> + "UNKNOWN",
> + "CREATE TABLESPACE",
> + "ALTER TABLESPACE",
> + "CREATE LOGFILE GROUP",
> + "ALTER LOGFILE GROUP",
> + "DROP TABLESPACE",
> + "DROP LOGFILE GROUP",
> + "CHANGE FILE TABLESPACE",
> + "ALTER ACCESS MODE TABLESPACE"
> +};
> +
> +
> +static const char* get_str_ts_command_type(enum ts_command_type ts_cmd_type)
> +{
> + if (ts_cmd_type < -1 || ts_cmd_type > 7)
> + ts_cmd_type= TS_CMD_NOT_DEFINED;
> + return str_ts_command_type[ts_cmd_type + 1];
> +}
> +
> +
> int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info)
> {
> int error= HA_ADMIN_NOT_IMPLEMENTED;
> @@ -47,8 +70,8 @@ int mysql_alter_tablespace(THD *thd, st_
> case 1:
> DBUG_RETURN(1);
> case HA_ADMIN_NOT_IMPLEMENTED:
> -
> - my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), "");
> + my_error(ER_COM_UNSUPPORTED, MYF(0), hton_name(hton)->str,
> + get_str_ts_command_type(ts_info->ts_cmd_type));
> break;
> case HA_ERR_TABLESPACE_EXIST:
> my_error(ER_TABLESPACE_EXIST, MYF(0), ts_info->tablespace_name);
>
>