List:Commits« Previous MessageNext Message »
From:Martin Skold Date:August 12 2008 9:36am
Subject:bzr push into mysql-5.1 branch (Martin.Skold:2644 to 2645)
View as plain text  
 2645 Martin Skold	2008-08-12
      Ignore trailing share only kept open temporarily by util thread.
modified:
  sql/ha_ndbcluster.cc
  sql/ha_ndbcluster.h

 2644 Frazer Clement	2008-08-11
      Bug#38717 readTuples() can be called > once
      
      Add state to NdbScanOperation to determine whether readTuples() has already been
called.
modified:
  storage/ndb/include/ndbapi/NdbScanOperation.hpp
  storage/ndb/src/ndbapi/NdbScanOperation.cpp

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2008-08-07 05:29:44 +0000
+++ b/sql/ha_ndbcluster.cc	2008-08-12 07:36:01 +0000
@@ -8393,9 +8393,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();
 
   /*
@@ -9709,6 +9717,7 @@ pthread_handler_t ndb_util_thread_func(v
 #endif /* HAVE_NDB_BINLOG */
       /* 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",
@@ -9734,7 +9743,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;
       }
 #endif /* HAVE_NDB_BINLOG */
@@ -9784,7 +9797,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-07 12:33:53 +0000
+++ b/sql/ha_ndbcluster.h	2008-08-12 07:36:01 +0000
@@ -152,6 +152,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
 #ifdef HAVE_NDB_BINLOG
   uint32 connect_count;
   uint32 flags;

Thread
bzr push into mysql-5.1 branch (Martin.Skold:2644 to 2645) Martin Skold12 Aug