List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:November 7 2011 7:54pm
Subject:bzr push into mysql-5.5-cluster branch (magnus.blaudd:3632 to 3635)
View as plain text  
 3635 Magnus Blåudd	2011-11-07
      ndbcluster
       - remove uneccessary lock of ndbcluster_mutex and instead don't use the have_lock argument to 'get_share'

    modified:
      sql/ha_ndbcluster_binlog.cc
 3634 Magnus Blåudd	2011-11-07
      ndb schema dist
       - mark mysqld_close_cached_table and ndbapi_invalidate_table as const

    modified:
      sql/ha_ndbcluster_binlog.cc
 3633 Magnus Blåudd	2011-11-07
      ndb schema dist
       - add specialized function to get the share form the db and table_name in Ndb_schema_op

    modified:
      sql/ha_ndbcluster_binlog.cc
 3632 magnus.blaudd@stripped	2011-11-07
      ndb - add missing new line in ndb_share.cc

    modified:
      sql/ndb_share.cc
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2011-11-07 18:59:32 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2011-11-07 19:53:22 +0000
@@ -2553,7 +2553,8 @@ class Ndb_schema_event_handler {
   }
 
 
-  void ndbapi_invalidate_table(const char* db_name, const char* table_name)
+  void
+  ndbapi_invalidate_table(const char* db_name, const char* table_name) const
   {
     Thd_ndb *thd_ndb= get_thd_ndb(m_thd);
     Ndb *ndb= thd_ndb->ndb;
@@ -2564,7 +2565,8 @@ class Ndb_schema_event_handler {
   }
 
 
-  void mysqld_close_cached_table(const char* db_name, const char* table_name)
+  void
+  mysqld_close_cached_table(const char* db_name, const char* table_name) const
   {
      // Just mark table as "need reopen"
     const bool wait_for_refresh = false;
@@ -2581,6 +2583,21 @@ class Ndb_schema_event_handler {
   }
 
 
+  NDB_SHARE* get_share(Ndb_schema_op* schema) const
+  {
+    char key[FN_REFLEN + 1];
+    build_table_filename(key, sizeof(key) - 1,
+                         schema->db, schema->name, "", 0);
+    NDB_SHARE *share= ndbcluster_get_share(key, 0, FALSE, FALSE);
+    if (share)
+    {
+      DBUG_PRINT("NDB_SHARE", ("%s temporary  use_count: %u",
+                               share->key, share->use_count));
+    }
+    return share;
+  }
+
+
   bool
   check_if_local_tables_in_db(const char *dbname) const
   {
@@ -2609,6 +2626,7 @@ class Ndb_schema_event_handler {
     DBUG_RETURN(false);
   }
 
+
   void handle_clear_slock(Ndb_schema_op* schema, bool post_epoch)
   {
     if (!post_epoch)
@@ -2773,29 +2791,15 @@ class Ndb_schema_event_handler {
           // Fall through
 	case SOT_TRUNCATE_TABLE:
         {
-          char key[FN_REFLEN + 1];
-          build_table_filename(key, sizeof(key) - 1,
-                               schema->db, schema->name, "", 0);
-          /* ndb_share reference temporary, free below */
-          NDB_SHARE *share= get_share(key, 0, FALSE, FALSE);
-          if (share)
-          {
-            DBUG_PRINT("NDB_SHARE", ("%s temporary  use_count: %u",
-                                     share->key, share->use_count));
-          }
+          NDB_SHARE *share= get_share(schema);
           // invalidation already handled by binlog thread
           if (!share || !share->op)
           {
             ndbapi_invalidate_table(schema->db, schema->name);
             mysqld_close_cached_table(schema->db, schema->name);
           }
-          /* ndb_share reference temporary free */
           if (share)
-          {
-            DBUG_PRINT("NDB_SHARE", ("%s temporary free  use_count: %u",
-                                     share->key, share->use_count));
             free_share(&share);
-          }
         }
         if (schema_type != SOT_TRUNCATE_TABLE)
           break;
@@ -2908,6 +2912,7 @@ class Ndb_schema_event_handler {
     DBUG_RETURN(0);
   }
 
+
   void
   handle_schema_op_post_epoch(Ndb_schema_op* schema)
   {
@@ -2939,13 +2944,7 @@ class Ndb_schema_event_handler {
                               schema->db ? schema->db : "(null)",
                               schema->name ? schema->name : "(null)");
 
-      /* ndb_share reference temporary, free below */
-      NDB_SHARE *share= get_share(key, 0, FALSE, FALSE);
-      if (share)
-      {
-        DBUG_PRINT("NDB_SHARE", ("%s temporary  use_count: %u",
-                                 share->key, share->use_count));
-      }
+      NDB_SHARE *share= get_share(schema);
       switch (schema_type)
       {
       case SOT_DROP_DB:
@@ -3198,6 +3197,7 @@ class Ndb_schema_event_handler {
     DBUG_VOID_RETURN;
   }
 
+
   /*
     process any operations that should be done after
     the epoch is complete
@@ -3246,6 +3246,7 @@ public:
   {
   }
 
+
   ~Ndb_schema_event_handler()
   {
     // There should be no work left todo...
@@ -3253,6 +3254,7 @@ public:
     DBUG_ASSERT(m_post_epoch_unlock_list.elements == 0);
   }
 
+
   void handle_event(Ndb* s_ndb, NdbEventOperation *pOp)
   {
     DBUG_ENTER("handle_event");
@@ -3390,6 +3392,7 @@ public:
     DBUG_VOID_RETURN;
   }
 
+
   void post_epoch()
   {
     if (m_post_epoch_log_list.elements > 0)
@@ -5067,17 +5070,14 @@ int ndbcluster_create_binlog_setup(THD *
   DBUG_ASSERT(! IS_NDB_BLOB_PREFIX(table_name));
   DBUG_ASSERT(strlen(key) == key_len);
 
-  pthread_mutex_lock(&ndbcluster_mutex);
-  NDB_SHARE * share = get_share(key, table, TRUE, TRUE);
+  NDB_SHARE* share= get_share(key, table, true, false);
   if (share == 0)
   {
     /**
      * Failed to create share
      */
-    pthread_mutex_unlock(&ndbcluster_mutex);
     DBUG_RETURN(-1);
   }
-  pthread_mutex_unlock(&ndbcluster_mutex);
 
   pthread_mutex_lock(&share->mutex);
   if (get_binlog_nologging(share) || share->op != 0 || share->new_op != 0)

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster branch (magnus.blaudd:3632 to 3635) Magnus Blåudd9 Nov