mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
BUG#6762 ALTER TABLE gives weird results and error message
- Removed hardcoded error message from 4.1 include/my_base.h: Adding error message for the case when table definition has changed in storage engine mysql-test/t/ndb_alter_table.test: Updated testresult to expect new error code sql/ha_ndbcluster.cc: Add mapping for ndb error 284 to HA_ERR_TABLE_DEF_CHANGED, this error will occur when the table definition has been changed by another MySQL Server connected to the cluster. Remove hardcoded errormessage from 4.1 sql/handler.cc: Adding error message for the case when table definition has changed in storage engine sql/share/errmsg.txt: Adding error message for the case when table definition has changed in storage engine
This commit is contained in:
parent
e73f1239dc
commit
f9d6463fdf
5 changed files with 14 additions and 12 deletions
|
@ -312,7 +312,9 @@ enum ha_base_keytype {
|
|||
#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */
|
||||
#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */
|
||||
#define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */
|
||||
#define HA_ERR_LAST 158 /*Copy last error nr.*/
|
||||
#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */
|
||||
|
||||
#define HA_ERR_LAST 159 /*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)
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ select * from t1 where b = 'two';
|
|||
connection server1;
|
||||
alter table t1 drop index c;
|
||||
connection server2;
|
||||
--error 1105
|
||||
--error 1412
|
||||
select * from t1 where b = 'two';
|
||||
select * from t1 where b = 'two';
|
||||
connection server1;
|
||||
|
|
|
@ -192,6 +192,8 @@ static const err_code_mapping err_map[]=
|
|||
{ 827, HA_ERR_RECORD_FILE_FULL, 1 },
|
||||
{ 832, HA_ERR_RECORD_FILE_FULL, 1 },
|
||||
|
||||
{ 284, HA_ERR_TABLE_DEF_CHANGED, 0 },
|
||||
|
||||
{ 0, 1, 0 },
|
||||
|
||||
{ -1, -1, 1 }
|
||||
|
@ -470,16 +472,7 @@ int ha_ndbcluster::ndb_err(NdbTransaction *trans)
|
|||
if (err.code != 709)
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBUG_PRINT("info", ("Table exist but must have changed"));
|
||||
/* In 5.0, this should be replaced with a mapping to a mysql error */
|
||||
my_printf_error(ER_UNKNOWN_ERROR,
|
||||
"Table definition has changed, "\
|
||||
"please retry transaction",
|
||||
MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
DBUG_PRINT("info", ("Table exists but must have changed"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -304,6 +304,7 @@ static int ha_init_errors(void)
|
|||
SETMSG(HA_ERR_NO_SUCH_TABLE, "No such table: '%.64s'");
|
||||
SETMSG(HA_ERR_TABLE_EXIST, ER(ER_TABLE_EXISTS_ERROR));
|
||||
SETMSG(HA_ERR_NO_CONNECTION, "Could not connect to storage engine");
|
||||
SETMSG(HA_ERR_TABLE_DEF_CHANGED, ER(ER_TABLE_DEF_CHANGED));
|
||||
|
||||
/* Register the error messages for use with my_error(). */
|
||||
return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST);
|
||||
|
@ -1646,6 +1647,9 @@ void handler::print_error(int error, myf errflag)
|
|||
case HA_ERR_NO_REFERENCED_ROW:
|
||||
textno=ER_NO_REFERENCED_ROW;
|
||||
break;
|
||||
case HA_ERR_TABLE_DEF_CHANGED:
|
||||
textno=ER_TABLE_DEF_CHANGED;
|
||||
break;
|
||||
case HA_ERR_NO_SUCH_TABLE:
|
||||
{
|
||||
/*
|
||||
|
|
|
@ -5336,3 +5336,6 @@ ER_CANT_CREATE_USER_WITH_GRANT 42000
|
|||
eng "You are not allowed to create a user with GRANT"
|
||||
ER_WRONG_VALUE_FOR_TYPE
|
||||
eng "Incorrect %-.32s value: '%-.128s' for function %-.32s"
|
||||
ER_TABLE_DEF_CHANGED
|
||||
eng "Table definition has changed, please retry transaction"
|
||||
|
||||
|
|
Loading…
Reference in a new issue