List:Commits« Previous MessageNext Message »
From:gni Date:November 29 2006 8:17am
Subject:bk commit into 5.0 tree (gni:1.2259) BUG#18676
View as plain text  
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-29 15:15:30+08:00, gni@dev3-127.(none) +4 -0
  BUG#18676 when cluster stoage engine is down, mysqld can't normally create talbe with
other storage engine. 

  mysql-test/r/ndb_autodiscover.result@stripped, 2006-11-29 15:15:25+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-29 15:15:25+08:00, gni@dev3-127.(none) +2 -0
    mapping ndbd error code for cluster storage engine into mysql error code, and adding
return error string from ndbapi

  sql/handler.cc@stripped, 2006-11-29 15:15:25+08:00, gni@dev3-127.(none) +15 -4
    making return value more meaningful

  sql/sql_table.cc@stripped, 2006-11-29 15:15:25+08:00, gni@dev3-127.(none) +17 -6
    if return value isn't HA_ERR_NO_SUCH_TABLE or HA_ERR_TABLE_EXIST, it has meanings just
only for cluster storage engine in 5.0 version.
    So we shouldn't simply believe the table has been created for local storage engines.

# 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.217/sql/handler.cc	2006-11-29 15:16:34 +08:00
+++ 1.218/sql/handler.cc	2006-11-29 15:16:34 +08:00
@@ -2413,22 +2413,33 @@ ha_find_files(THD *thd,const char *db,co
   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 retval;
   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);
 #endif
+  switch(error){
+    case 0:
+      retval = HA_ERR_NO_SUCH_TABLE;
+      break;
+    case 1:
+      retval = HA_ERR_TABLE_EXIST;
+      break;
+    default:
+      retval = error;
+  }
   DBUG_PRINT("exit", ("error: %d", error));
-  DBUG_RETURN(error);
+  DBUG_RETURN(retval);
 }
 
 

--- 1.320/sql/sql_table.cc	2006-11-29 15:16:35 +08:00
+++ 1.321/sql/sql_table.cc	2006-11-29 15:16:35 +08:00
@@ -1711,14 +1711,25 @@ bool mysql_create_table(THD *thd,const c
   {
     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);
+    switch (retcode)
     {
-      DBUG_PRINT("info", ("Table with same name already existed in handler"));
+      case HA_ERR_NO_SUCH_TABLE:               //do nothing
+        break;              
+      case HA_ERR_TABLE_EXIST:                //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", ("A error about storage engine occurs"));
+          my_error(HA_ERR_NO_CONNECTION, MYF(0),table_name);
+          goto end;
+        }
     }
   }
 

--- 1.26/mysql-test/r/ndb_autodiscover.result	2006-11-29 15:16:35 +08:00
+++ 1.27/mysql-test/r/ndb_autodiscover.result	2006-11-29 15:16:35 +08:00
@@ -382,7 +382,7 @@ create table t1 (a int primary key) engi
 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.279/sql/ha_ndbcluster.cc	2006-11-29 15:16:35 +08:00
+++ 1.280/sql/ha_ndbcluster.cc	2006-11-29 15:16:35 +08:00
@@ -204,6 +204,8 @@ static const err_code_mapping err_map[]=
 
   { 284, HA_ERR_TABLE_DEF_CHANGED, 0 },
 
+  {4009, HA_ERR_NO_CONNECTION, 1 },
+
   { 0, 1, 0 },
 
   { -1, -1, 1 }
Thread
bk commit into 5.0 tree (gni:1.2259) BUG#18676gni29 Nov