List:Commits« Previous MessageNext Message »
From:jonas Date:August 12 2008 9:47am
Subject:bzr push into mysql-5.1 branch (jonas:2664)
View as plain text  
 2664 jonas@stripped	2008-08-12 [merge]
      merge 6.2 to 6.3
modified:
  sql/ha_ndbcluster.cc
  sql/ha_ndbcluster.h
  storage/ndb/src/ndbapi/TransporterFacade.cpp

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2008-08-12 15:04:26 +0000
+++ b/sql/ha_ndbcluster.cc	2008-08-12 09:45:38 +0000
@@ -9464,9 +9464,17 @@ int handle_trailing_share(THD *thd, NDB_
     }
   }
 
-  sql_print_warning("NDB_SHARE: %s already exists  use_count=%d."
-                    " Moving away for safety, but possible memleak.",
-                    share->key, share->use_count);
+  DBUG_PRINT("info", ("NDB_SHARE: %s already exists use_count=%d, op=0x%lx.",
+                      share->key, share->use_count, (long) share->op));
+  /* 
+     Ignore table shares only opened by util thread
+   */
+  if (!((share->use_count == 1) && share->util_thread))
+  {
+    sql_print_warning("NDB_SHARE: %s already exists use_count=%d."
+                      " Moving away for safety, but possible memleak.",
+                      share->key, share->use_count);
+  }
   dbug_print_open_tables();
 
   /*
@@ -10836,6 +10844,7 @@ pthread_handler_t ndb_util_thread_func(v
         continue; // injector thread is the only user, skip statistics
       /* ndb_share reference temporary, free below */
       share->use_count++; /* Make sure the table can't be closed */
+      share->util_thread= true;
       DBUG_PRINT("NDB_SHARE", ("%s temporary  use_count: %u",
                                share->key, share->use_count));
       DBUG_PRINT("ndb_util_thread",
@@ -10860,7 +10869,11 @@ pthread_handler_t ndb_util_thread_func(v
         /* ndb_share reference temporary free */
         DBUG_PRINT("NDB_SHARE", ("%s temporary free  use_count: %u",
                                  share->key, share->use_count));
-        free_share(&share);
+        
+        pthread_mutex_lock(&ndbcluster_mutex);
+        share->util_thread= false;
+        free_share(&share, true);
+        pthread_mutex_unlock(&ndbcluster_mutex);
         continue;
       }
       DBUG_PRINT("ndb_util_thread",
@@ -10910,7 +10923,10 @@ pthread_handler_t ndb_util_thread_func(v
       /* ndb_share reference temporary free */
       DBUG_PRINT("NDB_SHARE", ("%s temporary free  use_count: %u",
                                share->key, share->use_count));
-      free_share(&share);
+      pthread_mutex_lock(&ndbcluster_mutex);
+      share->util_thread= false;
+      free_share(&share, true);
+      pthread_mutex_unlock(&ndbcluster_mutex);
     }
 next:
     /* Calculate new time to wake up */

=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h	2008-04-08 15:08:21 +0000
+++ b/sql/ha_ndbcluster.h	2008-08-12 09:45:38 +0000
@@ -180,6 +180,7 @@ typedef struct st_ndbcluster_share {
   char *table_name;
   Ndb::TupleIdRange tuple_id_range;
   struct Ndb_statistics stat;
+  bool util_thread; // if opened by util thread
   uint32 connect_count;
   uint32 flags;
 #ifdef HAVE_NDB_BINLOG

=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.cpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.cpp	2008-03-27 18:07:50 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.cpp	2008-08-12 09:45:38 +0000
@@ -1564,9 +1564,18 @@ SignalSender::sendSignal(Uint16 nodeId, 
 #endif
   assert(getNodeInfo(nodeId).m_api_reg_conf == true ||
          s->readSignalNumber() == GSN_API_REGREQ);
-  return theFacade->theTransporterRegistry->prepareSend(&s->header,
-							1, // JBB
-							&s->theData[0],
-							nodeId, 
-							&s->ptr[0]);
+  
+  SendStatus ss = 
+    theFacade->theTransporterRegistry->prepareSend(&s->header,
+                                                   1, // JBB
+                                                   &s->theData[0],
+                                                   nodeId, 
+                                                   &s->ptr[0]);
+
+  if (ss == SEND_OK)
+  {
+    theFacade->forceSend(m_blockNo);
+  }
+
+  return ss;
 }

Thread
bzr push into mysql-5.1 branch (jonas:2664) jonas12 Aug