Below is the list of changes that have just been committed into a local
5.0 repository of root. When root 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-04-03 18:44:29+08:00, gni@stripped +4 -0
BUG#18676 when cluster storage engine is down, misleading error message on create table
with 4009.
mysql-test/r/ndb_autodiscover.result@stripped, 2007-04-03 18:44:27+08:00,
gni@stripped +1 -1
changes ndbd error code to mysqld error code when no cluster connection
sql/ha_ndbcluster.cc@stripped, 2007-04-03 18:44:27+08:00, gni@stripped +5 -6
map 4009 error code to mysql not connected error
sql/handler.cc@stripped, 2007-04-03 18:44:27+08:00, gni@stripped +4 -4
define return codes to ha_table_exists_in_engine to something useful
NOTE: in 5.1 this should call a handlerton method, not horrible ifdef ndb stuff
sql/sql_table.cc@stripped, 2007-04-03 18:44:27+08:00, gni@stripped +19 -6
clearly define what happens on create table if exits/not exists/not connected to
engine
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: gni
# Host: dev3-221.dev.cn.tlan
# Root: /home/ngb/mysql/mysql-5.0/bug18676
--- 1.228/sql/handler.cc 2007-04-03 18:44:38 +08:00
+++ 1.229/sql/handler.cc 2007-04-03 18:44:38 +08:00
@@ -2442,14 +2442,14 @@
Ask handler if the table exists in engine
RETURN
- 0 Table does not exist
- 1 Table exists
- # Error code
+ HA_ERR_NO_SUCH_TABLE Table does not exist
+ HA_ERR_TABLE_EXIST Table exists
+ # Error code
*/
int ha_table_exists_in_engine(THD* thd, const char* db, const char* name)
{
- int error= 0;
+ int error= HA_ERR_NO_SUCH_TABLE;
DBUG_ENTER("ha_table_exists_in_engine");
DBUG_PRINT("enter", ("db: %s, name: %s", db, name));
#ifdef HAVE_NDBCLUSTER_DB
--- 1.333/sql/sql_table.cc 2007-04-03 18:44:38 +08:00
+++ 1.334/sql/sql_table.cc 2007-04-03 18:44:38 +08:00
@@ -1696,6 +1696,7 @@
alias);
DBUG_RETURN(FALSE);
}
+ DBUG_PRINT("info",("1"));
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias);
DBUG_RETURN(TRUE);
}
@@ -1706,6 +1707,7 @@
{
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
goto warn;
+ DBUG_PRINT("info",("2"));
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
goto end;
}
@@ -1724,14 +1726,25 @@
{
bool create_if_not_exists =
create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS;
- if (ha_table_exists_in_engine(thd, db, table_name))
+ int retcode = ha_table_exists_in_engine(thd, db, table_name);
+ DBUG_PRINT("info", ("exists_in_engine: %u",retcode));
+ switch (retcode)
{
- DBUG_PRINT("info", ("Table with same name already existed in handler"));
+ case HA_ERR_NO_SUCH_TABLE:
+ /* Normal case, no table exists. we can go and create it */
+ break;
+ case HA_ERR_TABLE_EXIST:
+ DBUG_PRINT("info", ("Table existed in handler"));
- if (create_if_not_exists)
- goto warn;
- my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
- goto end;
+ if (create_if_not_exists)
+ goto warn;
+ my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
+ goto end;
+ break;
+ default:
+ DBUG_PRINT("info", ("error: %u from storage engine", retcode));
+ my_error(retcode, MYF(0),table_name);
+ goto end;
}
}
--- 1.26/mysql-test/r/ndb_autodiscover.result 2007-04-03 18:44:38 +08:00
+++ 1.27/mysql-test/r/ndb_autodiscover.result 2007-04-03 18:44:38 +08:00
@@ -382,7 +382,7 @@
select * from t1;
a
select * from t1;
-ERROR HY000: Can't lock file (errno: 4009)
+ERROR HY000: Can't lock file (errno: 157)
use test;
drop database test_only_ndb_tables;
CREATE TABLE t9 (
--- 1.300/sql/ha_ndbcluster.cc 2007-04-03 18:44:38 +08:00
+++ 1.301/sql/ha_ndbcluster.cc 2007-04-03 18:44:38 +08:00
@@ -203,6 +203,8 @@
{ 284, HA_ERR_TABLE_DEF_CHANGED, 0 },
+ {4009, HA_ERR_NO_CONNECTION, 1 },
+
{ 0, 1, 0 },
{ -1, -1, 1 }
@@ -5042,14 +5044,11 @@
dict->invalidateTable(name);
if (!(tab= dict->getTable(name)))
{
- const NdbError err= dict->getNdbError();
- if (err.code == 709)
- DBUG_RETURN(0);
- ERR_RETURN(err);
+ ERR_RETURN(dict->getNdbError());
}
DBUG_PRINT("info", ("Found table %s", tab->getName()));
- DBUG_RETURN(1);
+ DBUG_RETURN(HA_ERR_TABLE_EXIST);
}
@@ -5234,7 +5233,7 @@
DBUG_PRINT("info", ("%s existed on disk", name));
// The .ndb file exists on disk, but it's not in list of tables in ndb
// Verify that handler agrees table is gone.
- if (ndbcluster_table_exists_in_engine(thd, db, file_name) == 0)
+ if (ndbcluster_table_exists_in_engine(thd, db, file_name) == HA_ERR_NO_SUCH_TABLE)
{
DBUG_PRINT("info", ("NDB says %s does not exists", file_name));
it.remove();
| Thread |
|---|
| • bk commit into 5.0 tree (gni:1.2478) BUG#18676 | gni | 3 Apr |