MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:tomas Date:February 5 2007 5:04am
Subject:bk commit into 5.1 tree (tomas:1.2415) BUG#26019
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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
  1.2415 07/02/05 12:04:36 tomas@stripped +1 -0
  Bug #26019 - valgrind warning ndbcluster_log_schema_op/safe_mutex_lock invalid read
  protect the setting of ndb_schema_share = NULL with a mutex

  sql/ha_ndbcluster_binlog.cc
    1.96 07/02/05 12:04:28 tomas@stripped +36 -0
    protect the setting of ndb_schema_share = NULL with a mutec

# 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:	tomas
# Host:	poseidon.mysql.com
# Root:	/home/tomas/mysql-5.1-telco-cga

--- 1.95/sql/ha_ndbcluster_binlog.cc	2006-12-31 07:04:56 +07:00
+++ 1.96/sql/ha_ndbcluster_binlog.cc	2007-02-05 12:04:28 +07:00
@@ -97,6 +97,7 @@
 
 NDB_SHARE *ndb_apply_status_share= 0;
 NDB_SHARE *ndb_schema_share= 0;
+pthread_mutex_t ndb_schema_share_mutex;
 
 /* Schema object distribution handling */
 HASH ndb_schema_objects;
@@ -621,6 +622,7 @@
 
   pthread_mutex_destroy(&injector_mutex);
   pthread_cond_destroy(&injector_cond);
+  pthread_mutex_destroy(&ndb_schema_share_mutex);
 #endif
   DBUG_RETURN(0);
 }
@@ -1271,6 +1273,16 @@
     int no_storage_nodes= g_ndb_cluster_connection->no_db_nodes();
     bitmap_init(&schema_subscribers, bitbuf, sizeof(bitbuf)*8, FALSE);
     bitmap_set_all(&schema_subscribers);
+
+    /* begin protect ndb_schema_share */
+    pthread_mutex_lock(&ndb_schema_share_mutex);
+    if (ndb_schema_share == 0)
+    {
+      pthread_mutex_unlock(&ndb_schema_share_mutex);
+      if (ndb_schema_object)
+        ndb_free_schema_object(&ndb_schema_object, FALSE);
+      DBUG_RETURN(0);    
+    }
     (void) pthread_mutex_lock(&ndb_schema_share->mutex);
     for (i= 0; i < no_storage_nodes; i++)
     {
@@ -1283,6 +1295,9 @@
       }
     }
     (void) pthread_mutex_unlock(&ndb_schema_share->mutex);
+    pthread_mutex_unlock(&ndb_schema_share_mutex);
+    /* end protect ndb_schema_share */
+
     if (updated)
     {
       bitmap_clear_bit(&schema_subscribers, node_id);
@@ -1478,6 +1493,14 @@
                                       &abstime);
       if (thd->killed)
         break;
+
+      /* begin protect ndb_schema_share */
+      pthread_mutex_lock(&ndb_schema_share_mutex);
+      if (ndb_schema_share == 0)
+      {
+        pthread_mutex_unlock(&ndb_schema_share_mutex);
+        break;
+      }
       (void) pthread_mutex_lock(&ndb_schema_share->mutex);
       for (i= 0; i < no_storage_nodes; i++)
       {
@@ -1487,6 +1510,8 @@
           bitmap_intersect(&schema_subscribers, tmp);
       }
       (void) pthread_mutex_unlock(&ndb_schema_share->mutex);
+      pthread_mutex_unlock(&ndb_schema_share_mutex);
+      /* end protect ndb_schema_share */
 
       /* remove any unsubscribed from ndb_schema_object->slock */
       bitmap_intersect(&ndb_schema_object->slock_bitmap, &schema_subscribers);
@@ -1910,8 +1935,14 @@
           ndb_binlog_tables_inited && ndb_binlog_running)
         sql_print_information("NDB Binlog: ndb tables initially "
                               "read only on reconnect.");
+
+      /* begin protect ndb_schema_share */
+      pthread_mutex_lock(&ndb_schema_share_mutex);
       free_share(&ndb_schema_share);
       ndb_schema_share= 0;
+      pthread_mutex_unlock(&ndb_schema_share_mutex);
+      /* end protect ndb_schema_share */
+
       close_cached_tables((THD*) 0, 0, (TABLE_LIST*) 0, FALSE);
       // fall through
     case NDBEVENT::TE_ALTER:
@@ -2278,6 +2309,7 @@
 
   pthread_mutex_init(&injector_mutex, MY_MUTEX_INIT_FAST);
   pthread_cond_init(&injector_cond, NULL);
+  pthread_mutex_init(&ndb_schema_share_mutex, MY_MUTEX_INIT_FAST);
 
   /* Create injector thread */
   if (pthread_create(&ndb_binlog_thread, &connection_attrib,
@@ -3966,8 +3998,12 @@
   }
   if (ndb_schema_share)
   {
+    /* begin protect ndb_schema_share */
+    pthread_mutex_lock(&ndb_schema_share_mutex);
     free_share(&ndb_schema_share);
     ndb_schema_share= 0;
+    pthread_mutex_unlock(&ndb_schema_share_mutex);
+    /* end protect ndb_schema_share */
   }
 
   /* remove all event operations */
Thread
bk commit into 5.1 tree (tomas:1.2415) BUG#26019tomas5 Feb