List:Commits« Previous MessageNext Message »
From:Martin Skold Date:April 26 2010 10:39am
Subject:bzr commit into mysql-5.1-telco-7.0 branch (Martin.Skold:3506) Bug#31853
View as plain text  
#At file:///home/marty/MySQL/mysql-5.1-telco-7.0/

 3506 Martin Skold	2010-04-26 [merge]
      Merge
      added:
        mysql-test/suite/ndb/r/ndb_disconnect_ddl.result
        mysql-test/suite/ndb/t/ndb_disconnect_ddl.test
      modified:
        sql/ha_ndbcluster.cc
        sql/partition_info.cc
        sql/sql_table.cc

=== added file 'mysql-test/suite/ndb/r/ndb_disconnect_ddl.result'
--- a/mysql-test/suite/ndb/r/ndb_disconnect_ddl.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/r/ndb_disconnect_ddl.result	2010-04-26 10:39:15 +0000
@@ -0,0 +1,10 @@
+DROP TABLE IF EXISTS t1;
+"testing the bug#31853"
+use test;
+create table t1(i int primary key) engine=ndb;
+create table t2(i int primary key) engine=ndb;
+ERROR HY000: Can't create table 'test.t2' (errno: 157)
+create table t3(i int primary key) engine=ndb;
+ERROR HY000: Can't create table 'test.t3' (errno: 157)
+drop table t1;
+"end of test the bug#31853"

=== added file 'mysql-test/suite/ndb/t/ndb_disconnect_ddl.test'
--- a/mysql-test/suite/ndb/t/ndb_disconnect_ddl.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/ndb_disconnect_ddl.test	2010-04-26 10:39:15 +0000
@@ -0,0 +1,51 @@
+--source include/have_ndb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--echo "testing the bug#31853"
+
+disable_query_log;
+call mtr.add_suppression("Could not acquire global schema lock");
+call mtr.add_suppression("Tables not available after 60 seconds.");
+enable_query_log;
+
+use test;
+create table t1(i int primary key) engine=ndb;
+
+# Restart cluster nodes "nostart"
+--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "all restart -n" >> $NDB_TOOLS_OUTPUT
+# Wait for all nodes to enter "nostart"
+--exec $NDB_WAITER --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" --not-started >> $NDB_TOOLS_OUTPUT
+
+--error ER_CANT_CREATE_TABLE
+create table t2(i int primary key) engine=ndb;
+
+let $mysqld_name=mysqld.1.1;
+--source include/restart_mysqld.inc
+
+--error ER_CANT_CREATE_TABLE
+create table t3(i int primary key) engine=ndb;
+
+# Start cluster nodes again
+--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "all start" >> $NDB_TOOLS_OUTPUT
+# Wait for all nodes to enter "started"
+--exec $NDB_WAITER --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" >> $NDB_TOOLS_OUTPUT
+
+
+#
+# Wait until the connection to the
+# cluster has been restored or timeout occurs
+#
+connection default;
+--disable_result_log
+--disable_query_log
+--source include/ndb_not_readonly.inc
+--enable_result_log
+--enable_query_log
+
+# cleanup
+drop table t1;
+
+--echo "end of test the bug#31853"

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2010-04-16 08:33:26 +0000
+++ b/sql/ha_ndbcluster.cc	2010-04-26 10:39:15 +0000
@@ -12104,6 +12104,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	2009-12-17 10:14:52 +0000
+++ b/sql/partition_info.cc	2010-04-26 09:14:53 +0000
@@ -192,8 +192,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;
@@ -262,8 +270,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	2010-03-12 11:56:09 +0000
+++ b/sql/sql_table.cc	2010-04-26 10:39:15 +0000
@@ -3798,7 +3798,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-telco-7.0 branch (Martin.Skold:3506) Bug#31853Martin Skold26 Apr