List:Commits« Previous MessageNext Message »
From:Guangbao Ni Date:February 12 2009 7:06pm
Subject:bzr commit into mysql-5.1 branch (gni:2648) Bug#31853
View as plain text  
#At file:///home/ngb/mysql/bzr/telco6.2-bug31853/

 2648 Guangbao Ni	2009-02-12
      BUG#31853 Wrong error message on failed cluster create table after after mysqld
            (re)start
added:
  mysql-test/suite/ndb/t/bug31853.test
  mysql-test/t/bug31853.test
modified:
  sql/ha_ndbcluster.cc
  sql/partition_info.cc
  sql/sql_table.cc

per-file messages:
  mysql-test/suite/ndb/t/bug31853.test
    Add test case to print the error messages under the following situations when create table:
    1)after ndb_mgmd and ndbd started , then stoped
    2)after mysqld restarted
  mysql-test/t/bug31853.test
    Add test case to print the error messages under the following situations when create table:
    1)ndb_mgmd and ndbd don't start
  sql/ha_ndbcluster.cc
    if not connected to ndb cluster, will return HA_ERR_NO_CONNECTION error to user
  sql/partition_info.cc
    if the return value of the member function get_default_no_partition() is less than 0,
    it means error happens.
  sql/sql_table.cc
    if the return value of the member function get_default_no_partition() is less than 0,
    it means error happens
=== added file 'mysql-test/suite/ndb/t/bug31853.test'
--- a/mysql-test/suite/ndb/t/bug31853.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/bug31853.test	2009-02-12 19:04:33 +0000
@@ -0,0 +1,20 @@
+-- source include/have_multi_ndb.inc
+-- source include/not_embedded.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+use test;
+create table t1(i int primary key) engine=ndb;
+
+--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "ALL STOP" >> $NDB_TOOLS_OUTPUT
+
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --not-started > /dev/null
+--error 157
+create table t2(i int primary key) engine=ndb;
+
+--source include/restart_mysqld.inc
+--error 157
+create table t3(i int primary key) engine=ndb;
+--echo "end of test the bug#31853"

=== added file 'mysql-test/t/bug31853.test'
--- a/mysql-test/t/bug31853.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug31853.test	2009-02-12 19:04:33 +0000
@@ -0,0 +1,11 @@
+-- source include/not_embedded.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+use test;
+--error 157
+create table t1(i int primary key) engine=ndb;
+
+--echo "end of test the bug#31853"

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2008-08-12 15:54:32 +0000
+++ b/sql/ha_ndbcluster.cc	2009-02-12 19:04:33 +0000
@@ -10014,6 +10014,11 @@ int ha_ndbcluster::get_default_no_partit
   uint reported_frags;
   uint no_fragments=
     get_no_fragments(max_rows >= min_rows ? max_rows : min_rows);
+  if (unlikely(g_ndb_cluster_connection->get_no_ready() <= 0))
+  {
+    my_error(HA_ERR_NO_CONNECTION, MYF(0));
+    return -1;
+  }
   uint no_nodes= g_ndb_cluster_connection->no_db_nodes();
   if (adjusted_frag_count(no_fragments, no_nodes, reported_frags))
   {

=== modified file 'sql/partition_info.cc'
--- a/sql/partition_info.cc	2008-03-20 11:22:02 +0000
+++ b/sql/partition_info.cc	2009-02-12 19:04:33 +0000
@@ -189,8 +189,16 @@ bool partition_info::set_up_default_part
     goto end;
   }
 
-  if ((no_parts == 0) &&
-      ((no_parts= file->get_default_no_partitions(info)) == 0))
+  if (no_parts == 0)
+  { 
+    int no_parts_tmp;
+    if ((no_parts_tmp= file->get_default_no_partitions(info)) < 0)
+      goto end;
+
+    no_parts= no_parts_tmp;
+  }
+
+  if (no_parts == 0)
   {
     my_error(ER_PARTITION_NOT_DEFINED_ERROR, MYF(0), "partitions");
     goto end;
@@ -259,8 +267,15 @@ bool partition_info::set_up_default_subp
   List_iterator<partition_element> part_it(partitions);
   DBUG_ENTER("partition_info::set_up_default_subpartitions");
 
-  if (no_subparts == 0)
-    no_subparts= file->get_default_no_partitions(info);
+  if (no_subparts == 0) 
+  {
+    int no_subparts_tmp;
+    if ((no_subparts_tmp= file->get_default_no_partitions(info)) < 0)
+      goto end;
+
+    no_subparts= no_subparts_tmp;
+  }
+
   if (unlikely((no_parts * no_subparts) > MAX_PARTITIONS))
   {
     my_error(ER_TOO_MANY_PARTITIONS_ERROR, MYF(0));

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2008-08-07 13:56:42 +0000
+++ b/sql/sql_table.cc	2009-02-12 19:04:33 +0000
@@ -3385,7 +3385,10 @@ bool mysql_create_table_no_lock(THD *thd
                  file->get_default_no_partitions(create_info))
       {
         DBUG_ASSERT(thd->lex->sql_command != SQLCOM_CREATE_TABLE);
-        part_info->no_subparts= file->get_default_no_partitions(create_info);
+        int no_parts_tmp;
+        if (unlikely((no_parts_tmp= file->get_default_no_partitions(create_info)) < 0))
+          goto err;
+        part_info->no_subparts= no_parts_tmp;
       }
     }
     else if (create_info->db_type != engine_type)

Thread
bzr commit into mysql-5.1 branch (gni:2648) Bug#31853Guangbao Ni12 Feb