List:Commits« Previous MessageNext Message »
From:msvensson Date:January 9 2008 11:59am
Subject:bk commit into 5.1 tree (msvensson:1.2680) BUG#33763
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of msvensson. When msvensson 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, 2008-01-09 12:59:20+01:00, msvensson@stripped +3 -0
  Bug#33763 Mysqld leaves readonly mode for cluster tables too early - part2
   - Open tables readonly while not properly initialized
   - Close cached tables when coming out of readonly mode
   - Apply basically same patch as for 32275

  mysql-test/include/ndb_not_readonly.inc@stripped, 2008-01-09 12:59:17+01:00, msvensson@stripped +2 -2
    Fix syntax of "die" call
    Remove the maskin of ER_GET_ERRMSG, should never happen

  sql/ha_ndbcluster.cc@stripped, 2008-01-09 12:59:17+01:00, msvensson@stripped +8 -2
    - Open tables readonly until binlog tables have been 
      initialized

  sql/ha_ndbcluster_binlog.cc@stripped, 2008-01-09 12:59:18+01:00, msvensson@stripped +7 -6
    - Reset "ndb_binlog_tables_inited" when something has happened to schema table,
    apply status table or when connection to cluster is lost. 
    - Close cached tabled after setting ndb_binlog_is_ready to cleanout any
    tables opened as readonly.

diff -Nrup a/mysql-test/include/ndb_not_readonly.inc b/mysql-test/include/ndb_not_readonly.inc
--- a/mysql-test/include/ndb_not_readonly.inc	2007-06-19 11:38:04 +02:00
+++ b/mysql-test/include/ndb_not_readonly.inc	2008-01-09 12:59:17 +01:00
@@ -11,13 +11,13 @@ let $counter= 600;
 while ($mysql_errno)
 {
   # Table is readonly until the mysqld has connected properly
-  --error 0,ER_NO_SUCH_TABLE,ER_OPEN_AS_READONLY,ER_GET_ERRMSG
+  --error 0,ER_NO_SUCH_TABLE,ER_OPEN_AS_READONLY
   replace into mysql.ndb_apply_status values(0,0,"",0,0);
   if ($mysql_errno)
   {
     if (!$counter)
     {
-      die("Failed while waiting for mysqld to come out of readonly mode");
+      die Failed while waiting for mysqld to come out of readonly mode;
     }
     dec $counter;
     --sleep 0.1
diff -Nrup a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
--- a/sql/ha_ndbcluster.cc	2007-11-21 21:09:21 +01:00
+++ b/sql/ha_ndbcluster.cc	2008-01-09 12:59:17 +01:00
@@ -5138,6 +5138,7 @@ int ha_ndbcluster::create(const char *na
           strcmp(m_tabname, NDB_SCHEMA_TABLE) == 0))
     {
       DBUG_PRINT("info", ("Schema distribution table not setup"));
+      DBUG_ASSERT(ndb_schema_share);
       DBUG_RETURN(HA_ERR_NO_CONNECTION);
     }
     single_user_mode = NdbDictionary::Table::SingleUserModeReadWrite;
@@ -5963,6 +5964,7 @@ ha_ndbcluster::delete_table(ha_ndbcluste
   if (!ndb_schema_share)
   {
     DBUG_PRINT("info", ("Schema distribution table not setup"));
+    DBUG_ASSERT(ndb_schema_share);
     DBUG_RETURN(HA_ERR_NO_CONNECTION);
   }
   /* ndb_share reference temporary */
@@ -6144,6 +6146,7 @@ int ha_ndbcluster::delete_table(const ch
   if (!ndb_schema_share)
   {
     DBUG_PRINT("info", ("Schema distribution table not setup"));
+    DBUG_ASSERT(ndb_schema_share);
     DBUG_RETURN(HA_ERR_NO_CONNECTION);
   }
 #endif
@@ -6424,8 +6427,11 @@ int ha_ndbcluster::open(const char *name
     DBUG_RETURN(res);
   }
 #ifdef HAVE_NDB_BINLOG
-  if (!ndb_binlog_tables_inited && ndb_binlog_running)
+  if (!ndb_binlog_tables_inited)
+  {
     table->db_stat|= HA_READ_ONLY;
+    sql_print_information("table '%s' opened read only", name);
+  }
 #endif
   DBUG_RETURN(0);
 }
@@ -6784,8 +6790,8 @@ static void ndbcluster_drop_database(han
   if (!ndb_schema_share)
   {
     DBUG_PRINT("info", ("Schema distribution table not setup"));
+    DBUG_ASSERT(ndb_schema_share);
     DBUG_VOID_RETURN;
-    //DBUG_RETURN(HA_ERR_NO_CONNECTION);
   }
 #endif
   ndbcluster_drop_database_impl(path);
diff -Nrup a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
--- a/sql/ha_ndbcluster_binlog.cc	2007-11-12 21:09:44 +01:00
+++ b/sql/ha_ndbcluster_binlog.cc	2008-01-09 12:59:18 +01:00
@@ -879,12 +879,9 @@ int ndbcluster_setup_binlog_table_shares
   {
     pthread_mutex_lock(&LOCK_open);
     ndb_binlog_tables_inited= TRUE;
-    if (ndb_binlog_running)
-    {
-      if (ndb_extra_logging)
-        sql_print_information("NDB Binlog: ndb tables writable");
-      close_cached_tables((THD*) 0, 0, (TABLE_LIST*) 0, TRUE);
-    }
+    if (ndb_extra_logging)
+      sql_print_information("NDB Binlog: ndb tables writable");
+    close_cached_tables((THD*) 0, 0, (TABLE_LIST*) 0, TRUE);
     pthread_mutex_unlock(&LOCK_open);
     /* Signal injector thread that all is setup */
     pthread_cond_signal(&injector_cond);
@@ -2029,6 +2026,7 @@ ndb_binlog_thread_handle_schema_event(TH
                                ndb_schema_share->use_count));
       free_share(&ndb_schema_share);
       ndb_schema_share= 0;
+      ndb_binlog_tables_inited= 0;
       pthread_mutex_unlock(&ndb_schema_share_mutex);
       /* end protect ndb_schema_share */
 
@@ -3226,6 +3224,7 @@ ndb_binlog_thread_handle_non_data_event(
                                share->key, share->use_count));
       free_share(&ndb_apply_status_share);
       ndb_apply_status_share= 0;
+      ndb_binlog_tables_inited= 0;
     }
     DBUG_PRINT("error", ("CLUSTER FAILURE EVENT: "
                         "%s  received share: 0x%lx  op: 0x%lx  share op: 0x%lx  "
@@ -3245,6 +3244,7 @@ ndb_binlog_thread_handle_non_data_event(
                                share->key, share->use_count));
       free_share(&ndb_apply_status_share);
       ndb_apply_status_share= 0;
+      ndb_binlog_tables_inited= 0;
     }
     /* ToDo: remove printout */
     if (ndb_extra_logging)
@@ -4220,6 +4220,7 @@ err:
                              ndb_schema_share->use_count));
     free_share(&ndb_schema_share);
     ndb_schema_share= 0;
+    ndb_binlog_tables_inited= 0;
     pthread_mutex_unlock(&ndb_schema_share_mutex);
     /* end protect ndb_schema_share */
   }
Thread
bk commit into 5.1 tree (msvensson:1.2680) BUG#33763msvensson9 Jan