Commit c2b59571 authored by unknown's avatar unknown

Merge whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-telco-gca

into  whalegate.ndb.mysql.com:/home/tomas/mysql-5.1-single-user


sql/ha_ndbcluster.cc:
  Auto merged
parents c86e03a2 3fa92490
......@@ -8553,6 +8553,8 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
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");
......@@ -8672,7 +8674,22 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
/* 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, 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; i < record_count; i++)
{
share= (NDB_SHARE *)hash_element(&ndbcluster_open_tables, i);
#ifdef HAVE_NDB_BINLOG
......@@ -8690,14 +8707,14 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
i, share->table_name, share->use_count));
/* Store pointer to table */
util_open_tables.push_back(share);
share_list[i]= 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 < record_count; i++)
{
share= share_list[i];
#ifdef HAVE_NDB_BINLOG
if ((share->use_count - (int) (share->op != 0) - (int) (share->op != 0))
<= 1)
......@@ -8758,10 +8775,7 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
share->key, share->use_count));
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;
......@@ -8789,6 +8803,8 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused)))
ndb_util_thread_end:
net_end(&thd->net);
ndb_util_thread_fail:
if (share_list)
delete [] share_list;
thd->cleanup();
delete thd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment