List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:January 19 2011 3:24pm
Subject:bzr push into mysql-5.5-telco-7.0 branch (magnus.blaudd:3134 to 3141)
View as plain text  
 3141 Magnus Blåudd	2011-01-19
      ndb
       - take exclusive metadata locks before before calling 'mysql_rm_table_part2'
       - NOTE! at least this will work  until we merge in 5.5.8
        where 'mysql_rm_table_part2' has been removed.
       - Inspired by Dlenev's patch for ha_ndbcluster in 5.5

    modified:
      sql/ha_ndbcluster.cc
 3140 Magnus Blåudd	2011-01-19
      ndb
       - ha_ndbcluster uses push_warning_printf with WARN_LEVEL_ERROR a _lot_ 
         to make it possible for the user to see the real error which was reported
         from ndb.
       -It's unfortunately no longer allowed to use WARN_LEVEL_ERROR
        with push_warning to push a warning that says ERROR on the warning stack.
      - Since there is code in puch_warning that automatically downgrades all
         WARN_LEVEL_ERROR to WARN_LEVEL_WARN, just remove the
         DBUG_ASSERT for now.
       - This causes different outpu, but may be a good change. Let's see.

    modified:
      sql/sql_error.cc
 3139 Magnus Blåudd	2011-01-19
      ndb
       - Remove all uses of LOCK_open except the one place around the
         call to 'assign_new_table_id' which is necessary to protect the
         global counter variable.
      - Inspired by Kostjas patches to ha_ndbcluster in 5.5

    modified:
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_binlog.cc
      sql/ha_ndbcluster_binlog.h
 3138 Magnus Blåudd	2011-01-19
      ndb
       - add MCP patch for ndb_wait_setup

    modified:
      sql/ha_ndbcluster_glue.h
      sql/mysqld.cc
      sql/slave.cc
 3137 Magnus Blåudd	2011-01-19
      mtr.pl fix for ndb
       - Setup environment variables for different ndb_* tools used throughout the
        ndb tests. 
       - NOTE! In general I'm advocating that each test should find the tools
          it need itself by running some embedded perl - but there are alrerady
           so many ndb tools used in various places.

    modified:
      mysql-test/mysql-test-run.pl
 3136 Magnus Blåudd	2011-01-19
      mtr.pl lockdown
        - Temporaily reduce the footprint of mtr.pl allowing it to run with a larger
           number of failing test

    modified:
      mysql-test/mysql-test-run.pl
 3135 Magnus Blåudd	2011-01-19
      mtr.pl fix for ndb
       - Detect from the mysqld version string if this is MySQL Cluster
        build and enable ndb engine and the ndb suite(s) by default

    modified:
      mysql-test/mysql-test-run.pl
 3134 Magnus Blåudd	2011-01-19
      Fix test failure in sys_vars.all_vars.test
       - Disable the ndbinfo engine for this test to avoid that the test reports that
         ndbinfo system variables does not have any tests.
       -  The ndbinfo system variables are testes in ndb.ndbinfo.test

    modified:
      mysql-test/suite/sys_vars/t/all_vars-master.opt
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2010-11-17 08:51:29 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-01-19 14:47:16 +0000
@@ -108,6 +108,7 @@ require "lib/mtr_misc.pl";
 $SIG{INT}= sub { mtr_error("Got ^C signal"); };
 
 our $mysql_version_id;
+my $mysql_version_extra;
 our $glob_mysql_test_dir;
 our $basedir;
 our $bindir;
@@ -303,6 +304,13 @@ my $opt_max_test_fail= env_or_val(MTR_MA
 
 my $opt_parallel= $ENV{MTR_PARALLEL} || 1;
 
+## MCP temp fixes to reduce footprint of large number of failing tests
+$opt_max_save_core = 1; # Don't save many cores
+$opt_max_save_datadir = 1; # Dont save many datadirs
+$opt_max_test_fail = 0; # Allow many tests to fail
+$opt_retry = 1; # Don't retry failed tests
+## MCP temp fixes end
+
 select(STDOUT);
 $| = 1; # Automatically flush STDOUT
 
@@ -1609,12 +1617,13 @@ sub collect_mysqld_features {
       # Look for version
       my $exe_name= basename($exe_mysqld);
       mtr_verbose("exe_name: $exe_name");
-      if ( $line =~ /^\S*$exe_name\s\sVer\s([0-9]*)\.([0-9]*)\.([0-9]*)/ )
+      if ( $line =~ /^\S*$exe_name\s\sVer\s([0-9]*)\.([0-9]*)\.([0-9]*)([^\s]*)/ )
       {
 	#print "Major: $1 Minor: $2 Build: $3\n";
 	$mysql_version_id= $1*10000 + $2*100 + $3;
 	#print "mysql_version_id: $mysql_version_id\n";
 	mtr_report("MySQL Version $1.$2.$3");
+	$mysql_version_extra= $4;
       }
     }
     else
@@ -1699,12 +1708,13 @@ sub collect_mysqld_features_from_running
 
   # Parse version
   my $version_str= $mysqld_variables{'version'};
-  if ( $version_str =~ /^([0-9]*)\.([0-9]*)\.([0-9]*)/ )
+  if ( $version_str =~ /^([0-9]*)\.([0-9]*)\.([0-9]*)([^\s]*)/ )
   {
     #print "Major: $1 Minor: $2 Build: $3\n";
     $mysql_version_id= $1*10000 + $2*100 + $3;
     #print "mysql_version_id: $mysql_version_id\n";
     mtr_report("MySQL Version $1.$2.$3");
+    $mysql_version_extra= $4;
   }
   mtr_error("Could not find version of MySQL") unless $mysql_version_id;
 }
@@ -2132,6 +2142,38 @@ sub environment_setup {
 		  ["storage/ndb/src/mgmclient", "bin"],
 		  "ndb_mgm");
 
+    $ENV{'NDB_WAITER'}= $exe_ndb_waiter;
+
+    $ENV{'NDB_RESTORE'}=
+      my_find_bin($bindir,
+		  ["storage/ndb/tools", "bin"],
+		  "ndb_restore");
+
+    $ENV{'NDB_CONFIG'}=
+      my_find_bin($bindir,
+		  ["storage/ndb/tools", "bin"],
+		  "ndb_config");
+
+    $ENV{'NDB_SELECT_ALL'}=
+      my_find_bin($bindir,
+		  ["storage/ndb/tools", "bin"],
+		  "ndb_select_all");
+
+    $ENV{'NDB_DROP_TABLE'}=
+      my_find_bin($bindir,
+		  ["storage/ndb/tools", "bin"],
+		  "ndb_drop_table");
+
+    $ENV{'NDB_DESC'}=
+      my_find_bin($bindir,
+		  ["storage/ndb/tools", "bin"],
+		  "ndb_desc");
+
+    $ENV{'NDB_SHOW_TABLES'}=
+      my_find_bin($bindir,
+		  ["storage/ndb/tools", "bin"],
+		  "ndb_show_tables");
+
     $ENV{'NDB_TOOLS_DIR'}=
       my_find_dir($bindir,
 		  ["storage/ndb/tools", "bin"]);
@@ -2510,6 +2552,17 @@ sub vs_config_dirs ($$) {
 sub check_ndbcluster_support ($) {
   my $mysqld_variables= shift;
 
+  # Check if this is MySQL Cluster, ie. mysql version string ends
+  # with -ndb-Y.Y.Y[-status]
+  if ( defined $mysql_version_extra &&
+       $mysql_version_extra =~ /^-ndb-/ )
+  {
+    mtr_report(" - MySQL Cluster");
+    # Enable ndb engine and add more test suites
+    $opt_include_ndbcluster = 1;
+    $DEFAULT_SUITES.=",ndb";
+  }
+
   if ($opt_include_ndbcluster)
   {
     $opt_skip_ndbcluster= 0;

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-01-14 15:25:27 +0000
+++ b/sql/ha_ndbcluster.cc	2011-01-19 15:17:11 +0000
@@ -8198,7 +8198,7 @@ cleanup_failed:
                                m_table->getObjectVersion(),
                                (is_truncate) ?
 			       SOT_TRUNCATE_TABLE : SOT_CREATE_TABLE, 
-			       0, 0, 1);
+			       NULL, NULL);
       break;
     }
   }
@@ -8518,7 +8518,7 @@ int ha_ndbcluster::rename_table(const ch
                              old_dbname, m_tabname,
                              ndb_table_id, ndb_table_version,
                              SOT_RENAME_TABLE_PREPARE,
-                             m_dbname, new_tabname, 1);
+                             m_dbname, new_tabname);
   }
   if (share)
   {
@@ -8606,7 +8606,7 @@ int ha_ndbcluster::rename_table(const ch
                                old_dbname, m_tabname,
                                ndb_table_id, ndb_table_version,
                                SOT_RENAME_TABLE,
-                               m_dbname, new_tabname, 1);
+                               m_dbname, new_tabname);
     }
     else
     {
@@ -8615,7 +8615,7 @@ int ha_ndbcluster::rename_table(const ch
                                m_dbname, new_tabname,
                                ndb_table_id, ndb_table_version,
                                SOT_ALTER_TABLE_COMMIT,
-                               0, 0, 1);
+                               NULL, NULL);
 
     }
   }
@@ -8819,7 +8819,7 @@ retry_temporary_error1:
                              thd->query(), thd->query_length(),
                              share->db, share->table_name,
                              ndb_table_id, ndb_table_version,
-                             SOT_DROP_TABLE, 0, 0, 1);
+                             SOT_DROP_TABLE, NULL, NULL);
   }
 
   if (share)
@@ -9772,7 +9772,6 @@ int ndbcluster_drop_database_impl(THD *t
   while ((tabname=it++))
   {
     tablename_to_filename(tabname, tmp, FN_REFLEN - (tmp - full_path)-1);
-    mysql_mutex_lock(&LOCK_open);
     if (ha_ndbcluster::delete_table(thd, 0, ndb, full_path, dbname, tabname))
     {
       const NdbError err= dict->getNdbError();
@@ -9782,7 +9781,6 @@ int ndbcluster_drop_database_impl(THD *t
         ret= ndb_to_mysql_error(&err);
       }
     }
-    mysql_mutex_unlock(&LOCK_open);
   }
 
   dict->invalidateDbGlobal(dbname);
@@ -9818,7 +9816,7 @@ static void ndbcluster_drop_database(han
   ndbcluster_log_schema_op(thd,
                            thd->query(), thd->query_length(),
                            db, "", table_id, table_version,
-                           SOT_DROP_DB, 0, 0, 0);
+                           SOT_DROP_DB, NULL, NULL);
   DBUG_VOID_RETURN;
 }
 
@@ -9943,7 +9941,6 @@ int ndbcluster_find_all_files(THD *thd)
       my_free((char*) data, MYF(MY_ALLOW_ZERO_PTR));
       my_free((char*) pack_data, MYF(MY_ALLOW_ZERO_PTR));
 
-      mysql_mutex_lock(&LOCK_open);
       if (discover)
       {
         /* ToDo 4.1 database needs to be created if missing */
@@ -9959,7 +9956,6 @@ int ndbcluster_find_all_files(THD *thd)
                                        elmt.database, elmt.name,
                                        TRUE);
       }
-      mysql_mutex_unlock(&LOCK_open);
     }
   }
   while (unhandled && retries);
@@ -10058,19 +10054,16 @@ int ndbcluster_find_files(handlerton *ht
                            file_name->str, reg_ext, 0);
       if (my_access(name, F_OK))
       {
-        mysql_mutex_lock(&LOCK_open);
         DBUG_PRINT("info", ("Table %s listed and need discovery",
                             file_name->str));
         if (ndb_create_table_from_engine(thd, db, file_name->str))
         {
-          mysql_mutex_unlock(&LOCK_open);
           push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
                               ER_TABLE_EXISTS_ERROR,
                               "Discover of table %s.%s failed",
                               db, file_name->str);
           continue;
         }
-        mysql_mutex_unlock(&LOCK_open);
       }
       DBUG_PRINT("info", ("%s existed in NDB _and_ on disk ", file_name->str));
       file_on_disk= TRUE;
@@ -10127,10 +10120,8 @@ int ndbcluster_find_files(handlerton *ht
       file_name_str= (char*)my_hash_element(&ok_tables, i);
       end= end1 +
         tablename_to_filename(file_name_str, end1, sizeof(name) - (end1 - name));
-      mysql_mutex_lock(&LOCK_open);
       ndbcluster_create_binlog_setup(thd, ndb, name, end-name,
                                      db, file_name_str, TRUE);
-      mysql_mutex_unlock(&LOCK_open);
     }
   }
 
@@ -10155,35 +10146,43 @@ int ndbcluster_find_files(handlerton *ht
     }
   }
 
-  if (!global_read_lock)
+  /*
+    Delete old files
+
+    ndbcluster_find_files() may be called from I_S code and ndbcluster_binlog
+    thread in situations when some tables are already open. This means that
+    code below will try to obtain exclusive metadata lock on some table
+    while holding shared meta-data lock on other tables. This might lead to a
+    deadlock but such a deadlock should be detected by MDL deadlock detector.
+  */
+  List_iterator_fast<char> it3(delete_list);
+  while ((file_name_str= it3++))
   {
-    // Delete old files
-    List_iterator_fast<char> it3(delete_list);
-    while ((file_name_str= it3++))
-    {
-      DBUG_PRINT("info", ("Remove table %s/%s", db, file_name_str));
-      // Delete the table and all related files
-      TABLE_LIST table_list;
-      bzero((char*) &table_list,sizeof(table_list));
-      table_list.db= (char*) db;
-      table_list.alias= table_list.table_name= (char*)file_name_str;
-      /*
-        set TNO_NO_NDB_DROP_TABLE flag to not drop ndb table.
-        it should not exist anyways
-      */
-      thd_ndb->options|= TNO_NO_NDB_DROP_TABLE;
-      (void)mysql_rm_table_part2(thd, &table_list,
-                                 FALSE,   /* if_exists */
-                                 FALSE,   /* drop_temporary */ 
-                                 FALSE,   /* drop_view */
-                                 TRUE     /* dont_log_query*/);
-      thd_ndb->options&= ~TNO_NO_NDB_DROP_TABLE;
-      /* Clear error message that is returned when table is deleted */
-      thd->clear_error();
-    }
+    DBUG_PRINT("info", ("Removing table %s/%s", db, file_name_str));
+    // Delete the table and all related files
+    TABLE_LIST table_list;
+    table_list.init_one_table(db, strlen(db),
+                              file_name_str, strlen(file_name_str),
+                              file_name_str,
+                              TL_WRITE);
+    table_list.mdl_request.set_type(MDL_EXCLUSIVE);
+    /*
+      set TNO_NO_NDB_DROP_TABLE flag to not drop ndb table.
+      it should not exist anyways
+    */
+    thd_ndb->options|= TNO_NO_NDB_DROP_TABLE;
+    (void)mysql_rm_table_part2(thd, &table_list,
+                               false,   /* if_exists */
+                               false,   /* drop_temporary */
+                               false,   /* drop_view */
+                               true     /* dont_log_query*/);
+    thd_ndb->options&= ~TNO_NO_NDB_DROP_TABLE;
+    trans_commit_implicit(thd); /* Safety, should be unnecessary. */
+    thd->mdl_context.release_transactional_locks();
+    /* Clear error message that is returned when table is deleted */
+    thd->clear_error();
   }
 
-  mysql_mutex_lock(&LOCK_open);
   // Create new files
   List_iterator_fast<char> it2(create_list);
   while ((file_name_str=it2++))
@@ -10198,8 +10197,6 @@ int ndbcluster_find_files(handlerton *ht
     }
   }
 
-  mysql_mutex_unlock(&LOCK_open);
-
   my_hash_free(&ok_tables);
   my_hash_free(&ndb_tables);
 
@@ -11099,7 +11096,7 @@ static void print_ndbcluster_open_tables
   
   Must be called with previous pthread_mutex_lock(&ndbcluster_mutex)
 */
-int handle_trailing_share(THD *thd, NDB_SHARE *share, int have_lock_open)
+int handle_trailing_share(THD *thd, NDB_SHARE *share)
 {
   static ulong trailing_share_id= 0;
   DBUG_ENTER("handle_trailing_share");
@@ -11116,13 +11113,7 @@ int handle_trailing_share(THD *thd, NDB_
   bzero((char*) &table_list,sizeof(table_list));
   table_list.db= share->db;
   table_list.alias= table_list.table_name= share->table_name;
-  if (have_lock_open)
-    mysql_mutex_assert_owner(&LOCK_open);
-  else
-    mysql_mutex_lock(&LOCK_open);
   close_cached_tables(thd, &table_list, TRUE, FALSE, FALSE);
-  if (!have_lock_open)
-    mysql_mutex_unlock(&LOCK_open);
 
   pthread_mutex_lock(&ndbcluster_mutex);
   /* ndb_share reference temporary free */
@@ -11245,7 +11236,7 @@ int ndbcluster_undo_rename_share(THD *th
   return 0;
 }
 
-int ndbcluster_rename_share(THD *thd, NDB_SHARE *share, int have_lock_open)
+int ndbcluster_rename_share(THD *thd, NDB_SHARE *share)
 {
   NDB_SHARE *tmp;
   pthread_mutex_lock(&ndbcluster_mutex);
@@ -11255,7 +11246,7 @@ int ndbcluster_rename_share(THD *thd, ND
   if ((tmp= (NDB_SHARE*) my_hash_search(&ndbcluster_open_tables,
                                         (const uchar*) share->new_key,
                                         new_length)))
-    handle_trailing_share(thd, tmp, have_lock_open);
+    handle_trailing_share(thd, tmp);
 
   /* remove the share from hash */
   my_hash_delete(&ndbcluster_open_tables, (uchar*) share);
@@ -13881,7 +13872,7 @@ int ha_ndbcluster::alter_table_phase3(TH
                            db, name,
                            table_id, table_version,
                            SOT_ONLINE_ALTER_TABLE_PREPARE,
-                           0, 0, 0);
+                           NULL, NULL);
 
   /*
     Get table id/version for new table
@@ -13913,7 +13904,7 @@ int ha_ndbcluster::alter_table_phase3(TH
                            db, name,
                            table_id, table_version,
                            SOT_ONLINE_ALTER_TABLE_COMMIT,
-                           0, 0, 0);
+                           NULL, NULL);
 
   delete alter_data;
   alter_info->data= 0;
@@ -14261,13 +14252,13 @@ int ndbcluster_alter_tablespace(handlert
                              thd->query(), thd->query_length(),
                              "", alter_info->tablespace_name,
                              table_id, table_version,
-                             SOT_TABLESPACE, 0, 0, 0);
+                             SOT_TABLESPACE, NULL, NULL);
   else
     ndbcluster_log_schema_op(thd,
                              thd->query(), thd->query_length(),
                              "", alter_info->logfile_group_name,
                              table_id, table_version,
-                             SOT_LOGFILE_GROUP, 0, 0, 0);
+                             SOT_LOGFILE_GROUP, NULL, NULL);
   DBUG_RETURN(FALSE);
 
 ndberror:

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2011-01-14 15:25:27 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2011-01-19 15:05:02 +0000
@@ -409,7 +409,6 @@ ndbcluster_binlog_open_table(THD *thd, N
   TABLE *table= event_data->table= 
     (TABLE*)alloc_root(&event_data->mem_root, sizeof(TABLE));
 
-  mysql_mutex_assert_owner(&LOCK_open);
   init_tmp_table_share(thd, table_share, share->db, 0, share->table_name, 
                        share->key);
   if ((error= open_table_def(thd, table_share, 0)) ||
@@ -427,7 +426,9 @@ ndbcluster_binlog_open_table(THD *thd, N
     *root_ptr= old_root;
     DBUG_RETURN(error);
   }
+  mysql_mutex_lock(&LOCK_open);
   assign_new_table_id(table_share);
+  mysql_mutex_unlock(&LOCK_open);
 
   table->in_use= injector_thd;
   
@@ -774,7 +775,7 @@ ndbcluster_binlog_log_query(handlerton *
   {
     ndbcluster_log_schema_op(thd, query, query_length,
                              db, table_name, table_id, table_version, type,
-                             0, 0, 0);
+                             NULL, NULL);
   }
   DBUG_VOID_RETURN;
 }
@@ -1562,9 +1563,7 @@ int ndbcluster_setup_binlog_table_shares
   if (!ndb_schema_share &&
       ndbcluster_check_ndb_schema_share() == 0)
   {
-    mysql_mutex_lock(&LOCK_open);
     ndb_create_table_from_engine(thd, NDB_REP_DB, NDB_SCHEMA_TABLE);
-    mysql_mutex_unlock(&LOCK_open);
     if (!ndb_schema_share)
     {
       ndbcluster_create_schema_table(thd);
@@ -1576,9 +1575,7 @@ int ndbcluster_setup_binlog_table_shares
   if (!ndb_apply_status_share &&
       ndbcluster_check_ndb_apply_status_share() == 0)
   {
-    mysql_mutex_lock(&LOCK_open);
     ndb_create_table_from_engine(thd, NDB_REP_DB, NDB_APPLY_TABLE);
-    mysql_mutex_unlock(&LOCK_open);
     if (!ndb_apply_status_share)
     {
       ndbcluster_create_ndb_apply_status_table(thd);
@@ -1594,7 +1591,6 @@ int ndbcluster_setup_binlog_table_shares
 
   if (!ndbcluster_find_all_files(thd))
   {
-    mysql_mutex_lock(&LOCK_open);
     ndb_binlog_tables_inited= TRUE;
     if (ndb_binlog_tables_inited &&
         ndb_binlog_running && ndb_binlog_is_ready)
@@ -1609,7 +1605,6 @@ int ndbcluster_setup_binlog_table_shares
       */
       ndb_notify_tables_writable();
     }
-    mysql_mutex_unlock(&LOCK_open);
     /* Signal injector thread that all is setup */
     pthread_cond_signal(&injector_cond);
   }
@@ -2017,8 +2012,7 @@ int ndbcluster_log_schema_op(THD *thd,
                              uint32 ndb_table_id,
                              uint32 ndb_table_version,
                              enum SCHEMA_OP_TYPE type,
-                             const char *new_db, const char *new_table_name,
-                             int have_lock_open)
+                             const char *new_db, const char *new_table_name)
 {
   DBUG_ENTER("ndbcluster_log_schema_op");
   Thd_ndb *thd_ndb= get_thd_ndb(thd);
@@ -2351,11 +2345,6 @@ end:
   {
     int max_timeout= DEFAULT_SYNC_TIMEOUT;
     pthread_mutex_lock(&ndb_schema_object->mutex);
-    if (have_lock_open)
-    {
-      mysql_mutex_assert_owner(&LOCK_open);
-      mysql_mutex_unlock(&LOCK_open);
-    }
     while (1)
     {
       struct timespec abstime;
@@ -2413,10 +2402,6 @@ end:
                              &ndb_schema_object->slock_bitmap);
       }
     }
-    if (have_lock_open)
-    {
-      mysql_mutex_lock(&LOCK_open);
-    }
     pthread_mutex_unlock(&ndb_schema_object->mutex);
   }
   else if (ndb_error)
@@ -2791,7 +2776,6 @@ ndb_binlog_thread_handle_schema_event(TH
         // fall through
         case SOT_CREATE_TABLE:
           thd_ndb_options.set(TNO_NO_LOCK_SCHEMA_OP);
-          mysql_mutex_lock(&LOCK_open);
           if (ndbcluster_check_if_local_table(schema->db, schema->name))
           {
             DBUG_PRINT("info", ("NDB Binlog: Skipping locally defined table '%s.%s'",
@@ -2810,7 +2794,6 @@ ndb_binlog_thread_handle_schema_event(TH
                             schema->node_id, my_errno);
             print_warning_list("NDB Binlog", thd_warn_list(thd));
           }
-          mysql_mutex_unlock(&LOCK_open);
           log_query= 1;
           break;
         case SOT_DROP_DB:
@@ -3106,9 +3089,7 @@ ndb_binlog_thread_handle_schema_event_po
         log_query= 1;
         if (share)
         {
-          mysql_mutex_lock(&LOCK_open);
           ndbcluster_rename_share(thd, share);
-          mysql_mutex_unlock(&LOCK_open);
         }
         break;
       case SOT_RENAME_TABLE_PREPARE:
@@ -3169,7 +3150,6 @@ ndb_binlog_thread_handle_schema_event_po
             share= 0;
           }
           thd_ndb_options.set(TNO_NO_LOCK_SCHEMA_OP);
-          mysql_mutex_lock(&LOCK_open);
           if (ndbcluster_check_if_local_table(schema->db, schema->name))
           {
             DBUG_PRINT("info", ("NDB Binlog: Skipping locally defined table '%s.%s'",
@@ -3187,7 +3167,6 @@ ndb_binlog_thread_handle_schema_event_po
                             schema->node_id, my_errno);
             print_warning_list("NDB Binlog", thd_warn_list(thd));
           }
-          mysql_mutex_unlock(&LOCK_open);
         }
         break;
       case SOT_ONLINE_ALTER_TABLE_PREPARE:
@@ -3207,7 +3186,6 @@ ndb_binlog_thread_handle_schema_event_po
           Refresh local frm file and dictionary cache if
           remote on-line alter table
         */
-        mysql_mutex_lock(&LOCK_open);
         TABLE_LIST table_list;
         bzero((char*) &table_list,sizeof(table_list));
         table_list.db= (char *)schema->db;
@@ -3249,9 +3227,7 @@ ndb_binlog_thread_handle_schema_event_po
           my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
           my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR));
         }
-        if (!share)
-          mysql_mutex_unlock(&LOCK_open);
-        else
+        if (share)
         {
           if (opt_ndb_extra_logging > 9)
             sql_print_information("NDB Binlog: handeling online alter/rename");
@@ -3262,7 +3238,6 @@ ndb_binlog_thread_handle_schema_event_po
           if ((error= ndbcluster_binlog_open_table(thd, share)))
             sql_print_error("NDB Binlog: Failed to re-open table %s.%s",
                             schema->db, schema->name);
-          mysql_mutex_unlock(&LOCK_open);
           if (error)
             pthread_mutex_unlock(&share->mutex);
         }
@@ -3348,7 +3323,6 @@ ndb_binlog_thread_handle_schema_event_po
             share= 0;
           }
           thd_ndb_options.set(TNO_NO_LOCK_SCHEMA_OP);
-          mysql_mutex_lock(&LOCK_open);
           if (ndbcluster_check_if_local_table(schema->db, schema->name))
           {
             DBUG_PRINT("info", ("NDB Binlog: Skipping locally defined table '%s.%s'",
@@ -3366,7 +3340,6 @@ ndb_binlog_thread_handle_schema_event_po
                             schema->node_id, my_errno);
             print_warning_list("NDB Binlog", thd_warn_list(thd));
           }
-          mysql_mutex_unlock(&LOCK_open);
         }
         break;
       default:
@@ -5086,8 +5059,6 @@ ndbcluster_handle_drop_table(THD *thd, N
 #ifdef SYNC_DROP_
   thd->proc_info= "Syncing ndb table schema operation and binlog";
   pthread_mutex_lock(&share->mutex);
-  mysql_mutex_assert_owner(&LOCK_open);
-  mysql_mutex_unlock(&LOCK_open);
   int max_timeout= DEFAULT_SYNC_TIMEOUT;
   while (share->op)
   {
@@ -5114,7 +5085,6 @@ ndbcluster_handle_drop_table(THD *thd, N
                            type_str, share->key, 0);
     }
   }
-  mysql_mutex_lock(&LOCK_open);
   pthread_mutex_unlock(&share->mutex);
 #else
   pthread_mutex_lock(&share->mutex);

=== modified file 'sql/ha_ndbcluster_binlog.h'
--- a/sql/ha_ndbcluster_binlog.h	2010-11-10 10:37:58 +0000
+++ b/sql/ha_ndbcluster_binlog.h	2011-01-19 15:05:02 +0000
@@ -225,8 +225,7 @@ int ndbcluster_log_schema_op(THD *thd,
                              uint32 ndb_table_version,
                              enum SCHEMA_OP_TYPE type,
                              const char *new_db,
-                             const char *new_table_name,
-                             int have_lock_open);
+                             const char *new_table_name);
 int ndbcluster_drop_event(THD *thd, Ndb *ndb, NDB_SHARE *share,
                           const char *type_str,
                           const char * dbname, const char * tabname);
@@ -285,9 +284,9 @@ NDB_SHARE *ndbcluster_get_share(const ch
 NDB_SHARE *ndbcluster_get_share(NDB_SHARE *share);
 void ndbcluster_free_share(NDB_SHARE **share, bool have_lock);
 void ndbcluster_real_free_share(NDB_SHARE **share);
-int handle_trailing_share(THD *thd, NDB_SHARE *share, int have_lock_open= 1);
+int handle_trailing_share(THD *thd, NDB_SHARE *share);
 int ndbcluster_prepare_rename_share(NDB_SHARE *share, const char *new_key);
-int ndbcluster_rename_share(THD *thd, NDB_SHARE *share, int have_lock_open= 1);
+int ndbcluster_rename_share(THD *thd, NDB_SHARE *share);
 int ndbcluster_undo_rename_share(THD *thd, NDB_SHARE *share);
 inline NDB_SHARE *get_share(const char *key,
                             TABLE *table,

=== modified file 'sql/ha_ndbcluster_glue.h'
--- a/sql/ha_ndbcluster_glue.h	2011-01-14 14:37:28 +0000
+++ b/sql/ha_ndbcluster_glue.h	2011-01-19 14:53:52 +0000
@@ -103,9 +103,6 @@ enum column_format_type {
 /* Missing functionality in injector -> no --ndb-log-empty-epochs */
 #define NDB_NO_LOG_EMPTY_EPOCHS
 
-/* No support for --ndb-wait_setup */
-#define NDB_NO_WAIT_SETUP
-
 /*
   The enum open_table_mode has been removed in 5.5.7 and 'open_table_from_share'
   now takes "bool is_create_table" instead of the enum type. Define OTM_OPEN

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-11-16 12:37:26 +0000
+++ b/sql/mysqld.cc	2011-01-19 14:53:52 +0000
@@ -413,6 +413,10 @@ handlerton *partition_hton;
 uint opt_server_id_bits= 0;
 ulong opt_server_id_mask= 0;
 #endif
+#ifndef MCP_BUG46955
+extern int(*ndb_wait_setup_func)(ulong);
+extern ulong opt_ndb_wait_setup;
+#endif
 my_bool opt_readonly= 0, use_temp_pool, relay_log_purge;
 my_bool relay_log_recovery;
 my_bool opt_sync_frm, opt_allow_suspicious_udfs;
@@ -4584,6 +4588,17 @@ int mysqld_main(int argc, char **argv)
   mysql_cond_signal(&COND_server_started);
   mysql_mutex_unlock(&LOCK_server_started);
 
+#ifndef MCP_BUG46955
+#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
+  if (ndb_wait_setup_func && ndb_wait_setup_func(opt_ndb_wait_setup))
+  {
+    sql_print_warning("NDB : Tables not available after %lu seconds."
+                      "  Consider increasing --ndb-wait-setup value",
+                      opt_ndb_wait_setup);
+  }
+#endif
+#endif
+
 #if defined(_WIN32) || defined(HAVE_SMEM)
   handle_connections_methods();
 #else

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2010-11-29 14:38:44 +0000
+++ b/sql/slave.cc	2011-01-19 14:53:52 +0000
@@ -3108,6 +3108,11 @@ int check_temp_dir(char* tmp_file)
   DBUG_RETURN(0);
 }
 
+#ifndef MCP_BUG46955
+extern int(*ndb_wait_setup_func)(ulong);
+extern ulong opt_ndb_wait_setup;
+#endif
+
 /**
   Slave SQL thread entry point.
 
@@ -3236,6 +3241,17 @@ pthread_handler_t handle_slave_sql(void
 #endif
   DBUG_ASSERT(rli->sql_thd == thd);
 
+#ifndef MCP_BUG46955
+#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
+  if (ndb_wait_setup_func && ndb_wait_setup_func(opt_ndb_wait_setup))
+  {
+    sql_print_warning("Slave SQL thread : NDB : Tables not available after %lu"
+                      " seconds.  Consider increasing --ndb-wait-setup value",
+                      opt_ndb_wait_setup);
+  }
+#endif
+#endif
+
   DBUG_PRINT("master_info",("log_file_name: %s  position: %s",
                             rli->group_master_log_name,
                             llstr(rli->group_master_log_pos,llbuff)));

=== modified file 'sql/sql_error.cc'
--- a/sql/sql_error.cc	2010-10-27 11:32:32 +0000
+++ b/sql/sql_error.cc	2011-01-19 15:09:32 +0000
@@ -579,12 +579,14 @@ void push_warning(THD *thd, MYSQL_ERROR:
   DBUG_ENTER("push_warning");
   DBUG_PRINT("enter", ("code: %d, msg: %s", code, msg));
 
+#ifdef MCP_BUGXXX
   /*
     Calling push_warning/push_warning_printf with a level of
     WARN_LEVEL_ERROR *is* a bug.  Either use my_printf_error(),
     my_error(), or WARN_LEVEL_WARN.
   */
   DBUG_ASSERT(level != MYSQL_ERROR::WARN_LEVEL_ERROR);
+#endif
 
   if (level == MYSQL_ERROR::WARN_LEVEL_ERROR)
     level= MYSQL_ERROR::WARN_LEVEL_WARN;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-telco-7.0 branch (magnus.blaudd:3134 to 3141) Magnus Blåudd19 Jan