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, 2006-11-16 11:51:47+08:00, gni@dev3-127.(none) +7 -0
BUG#18676 when cluster stoage engine is down, mysqld can't normally create talbe with
other storage engine.
include/my_base.h@stripped, 2006-11-16 11:51:45+08:00, gni@dev3-127.(none) +2 -1
Adding HA_ERR_CLUSTER_FAILUER error code for ndbcluster storage engine in mysqld
mysql-test/r/ndb_autodiscover.result@stripped, 2006-11-16 11:51:45+08:00,
gni@dev3-127.(none) +1 -1
changes ndbd error code to mysqld error code for cluster failure
sql/ha_ndbcluster.cc@stripped, 2006-11-16 11:51:45+08:00, gni@dev3-127.(none) +7 -2
mapping ndbd error code for cluster storage engine into mysql error code, and adding
return error string from ndbapi
sql/ha_ndbcluster.h@stripped, 2006-11-16 11:51:45+08:00, gni@dev3-127.(none) +2 -1
adding error string return parameter in order to return error string
sql/handler.cc@stripped, 2006-11-16 11:51:45+08:00, gni@dev3-127.(none) +4 -2
register new error string for cluster stroage engine in mysqld and add return error
message parameter
sql/handler.h@stripped, 2006-11-16 11:51:45+08:00, gni@dev3-127.(none) +2 -1
add return error message parameter
sql/sql_table.cc@stripped, 2006-11-16 11:51:45+08:00, gni@dev3-127.(none) +19 -6
if return value is greater than 1, it has meanings just for cluster storage engine in
5.0 version.
So we shouldn't simply believe the table has been created.
# 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-127.(none)
# Root: /mnt/mysql/home/ngb/mysql-5.0/bug18676
--- 1.79/include/my_base.h 2006-11-16 11:52:51 +08:00
+++ 1.80/include/my_base.h 2006-11-16 11:52:51 +08:00
@@ -358,7 +358,8 @@
#define HA_ERR_TABLE_NEEDS_UPGRADE 160 /* The table changed in storage engine */
#define HA_ERR_TABLE_READONLY 161 /* The table is not writable */
-#define HA_ERR_LAST 161 /*Copy last error nr.*/
+#define HA_ERR_CLUSTER_FAILURE 162 /* ndb cluster failure */
+#define HA_ERR_LAST 162 /*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)
--- 1.217/sql/handler.cc 2006-11-16 11:52:51 +08:00
+++ 1.218/sql/handler.cc 2006-11-16 11:52:51 +08:00
@@ -430,6 +430,7 @@
SETMSG(HA_ERR_TABLE_NEEDS_UPGRADE, ER(ER_TABLE_NEEDS_UPGRADE));
SETMSG(HA_ERR_TABLE_READONLY, ER(ER_OPEN_AS_READONLY));
+ SETMSG(HA_ERR_CLUSTER_FAILURE, "Cluster failure");
/* Register the error messages for use with my_error(). */
return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST);
}
@@ -2418,14 +2419,15 @@
# Error code
*/
-int ha_table_exists_in_engine(THD* thd, const char* db, const char* name)
+int ha_table_exists_in_engine(THD* thd, const char* db, const char* name,
+ char* errmsg)
{
int error= 0;
DBUG_ENTER("ha_table_exists_in_engine");
DBUG_PRINT("enter", ("db: %s, name: %s", db, name));
#ifdef HAVE_NDBCLUSTER_DB
if (have_ndbcluster == SHOW_OPTION_YES)
- error= ndbcluster_table_exists_in_engine(thd, db, name);
+ error= ndbcluster_table_exists_in_engine(thd, db, name, errmsg);
#endif
DBUG_PRINT("exit", ("error: %d", error));
DBUG_RETURN(error);
--- 1.177/sql/handler.h 2006-11-16 11:52:51 +08:00
+++ 1.178/sql/handler.h 2006-11-16 11:52:51 +08:00
@@ -929,7 +929,8 @@
const void** frmblob, uint* frmlen);
int ha_find_files(THD *thd,const char *db,const char *path,
const char *wild, bool dir,List<char>* files);
-int ha_table_exists_in_engine(THD* thd, const char* db, const char* name);
+int ha_table_exists_in_engine(THD* thd, const char* db, const char* name,
+ char* errmsg);
/* key cache */
int ha_init_key_cache(const char *name, KEY_CACHE *key_cache);
--- 1.320/sql/sql_table.cc 2006-11-16 11:52:51 +08:00
+++ 1.321/sql/sql_table.cc 2006-11-16 11:52:51 +08:00
@@ -1711,14 +1711,27 @@
{
bool create_if_not_exists =
create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS;
- if (ha_table_exists_in_engine(thd, db, table_name))
+ char errmsg[512];
+ bzero(errmsg,512);
+ int errcode = ha_table_exists_in_engine(thd, db, table_name, errmsg);
+ switch (errcode)
{
- DBUG_PRINT("info", ("Table with same name already existed in handler"));
+ case 0: //do nothing
+ break;
+ case 1: //table has already existed
+ DBUG_PRINT("info", ("Table with same name already 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: //only when ndbcluster engine fails, it can arrive here
+ if (create_info->db_type == DB_TYPE_NDBCLUSTER){
+ DBUG_PRINT("info", ("ndbcluster engine error occurs"));
+ my_error(errcode, MYF(0),errmsg);
+ goto end;
+ }
}
}
--- 1.26/mysql-test/r/ndb_autodiscover.result 2006-11-16 11:52:51 +08:00
+++ 1.27/mysql-test/r/ndb_autodiscover.result 2006-11-16 11:52:51 +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: 162)
use test;
drop database test_only_ndb_tables;
CREATE TABLE t9 (
--- 1.279/sql/ha_ndbcluster.cc 2006-11-16 11:52:51 +08:00
+++ 1.280/sql/ha_ndbcluster.cc 2006-11-16 11:52:51 +08:00
@@ -204,6 +204,8 @@
{ 284, HA_ERR_TABLE_DEF_CHANGED, 0 },
+ { 4009, HA_ERR_CLUSTER_FAILURE, 1 },
+
{ 0, 1, 0 },
{ -1, -1, 1 }
@@ -4893,7 +4895,8 @@
*/
-int ndbcluster_table_exists_in_engine(THD* thd, const char *db, const char *name)
+int ndbcluster_table_exists_in_engine(THD* thd, const char *db, const char *name,
+ char *errmsg)
{
const NDBTAB* tab;
Ndb* ndb;
@@ -4910,6 +4913,8 @@
if (!(tab= dict->getTable(name)))
{
const NdbError err= dict->getNdbError();
+ if ( errmsg != NULL )
+ strncpy(errmsg, err.message, strlen(err.message));
if (err.code == 709)
DBUG_RETURN(0);
ERR_RETURN(err);
@@ -5086,7 +5091,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, NULL) == 0)
{
DBUG_PRINT("info", ("NDB says %s does not exists", file_name));
it.remove();
--- 1.100/sql/ha_ndbcluster.h 2006-11-16 11:52:51 +08:00
+++ 1.101/sql/ha_ndbcluster.h 2006-11-16 11:52:51 +08:00
@@ -746,7 +746,8 @@
int ndbcluster_find_files(THD *thd,const char *db,const char *path,
const char *wild, bool dir, List<char> *files);
int ndbcluster_table_exists_in_engine(THD* thd,
- const char *db, const char *name);
+ const char *db, const char *name,
+ char *errmsg);
int ndbcluster_drop_database(const char* path);
void ndbcluster_print_error(int error, const NdbOperation *error_op);
| Thread |
|---|
| • bk commit into 5.0 tree (gni:1.2259) BUG#18676 | gni | 16 Nov |