List:Commits« Previous MessageNext Message »
From:tomas Date:April 3 2007 7:00am
Subject:bk commit into 5.1 tree (tomas:1.2485)
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@stripped, 2007-04-03 09:00:02+02:00, tomas@stripped +1 -0
  Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-telco-gca
  into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-telco-6.1
  MERGE: 1.2403.9.25

  sql/ha_ndbcluster.cc@stripped, 2007-04-03 08:59:58+02:00, tomas@stripped +0 -0
    Auto merged
    MERGE: 1.397.1.8

# 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:	whalegate.ndb.mysql.com
# Root:	/home/tomas/mysql-5.1-telco-6.1/RESYNC

--- 1.405/sql/ha_ndbcluster.cc	2007-03-29 11:37:56 +02:00
+++ 1.406/sql/ha_ndbcluster.cc	2007-04-03 08:59:58 +02:00
@@ -8458,6 +8458,8 @@
   struct timespec abstime;
   List<NDB_SHARE> util_open_tables;
   Thd_ndb *thd_ndb;
+  uint share_list_size= 0;
+  NDB_SHARE **share_list= NULL;
 
   my_thread_init();
   DBUG_ENTER("ndb_util_thread");
@@ -8578,7 +8580,22 @@
     /* Lock mutex and fill list with pointers to all open tables */
     NDB_SHARE *share;
     pthread_mutex_lock(&ndbcluster_mutex);
-    for (uint i= 0; i < ndbcluster_open_tables.records; i++)
+    uint i, open_count, record_count= ndbcluster_open_tables.records;
+    if (share_list_size < record_count)
+    {
+      NDB_SHARE ** new_share_list= new NDB_SHARE * [record_count];
+      if (!new_share_list)
+      {
+        sql_print_warning("ndb util thread: malloc failure, "
+                          "query cache not maintained properly");
+        pthread_mutex_unlock(&ndbcluster_mutex);
+        goto next;                               // At least do not crash
+      }
+      delete [] share_list;
+      share_list_size= record_count;
+      share_list= new_share_list;
+    }
+    for (i= 0, open_count= 0; i < record_count; i++)
     {
       share= (NDB_SHARE *)hash_element(&ndbcluster_open_tables, i);
 #ifdef HAVE_NDB_BINLOG
@@ -8593,14 +8610,14 @@
                   i, share->table_name, share->use_count));
 
       /* Store pointer to table */
-      util_open_tables.push_back(share);
+      share_list[open_count++]= share;
     }
     pthread_mutex_unlock(&ndbcluster_mutex);
 
-    /* Iterate through the  open files list */
-    List_iterator_fast<NDB_SHARE> it(util_open_tables);
-    while ((share= it++))
+    /* Iterate through the open files list */
+    for (i= 0; i < open_count; i++)
     {
+      share= share_list[i];
 #ifdef HAVE_NDB_BINLOG
       if ((share->use_count - (int) (share->op != 0) - (int) (share->op != 0))
           <= 1)
@@ -8654,10 +8671,7 @@
       /* Decrease the use count and possibly free share */
       free_share(&share);
     }
-
-    /* Clear the list of open tables */
-    util_open_tables.empty();
-
+next:
     /* Calculate new time to wake up */
     int secs= 0;
     int msecs= ndb_cache_check_time;
@@ -8685,6 +8699,8 @@
 ndb_util_thread_end:
   net_end(&thd->net);
 ndb_util_thread_fail:
+  if (share_list)
+    delete [] share_list;
   thd->cleanup();
   delete thd;
   
Thread
bk commit into 5.1 tree (tomas:1.2485)tomas3 Apr