From b84e64f7dfc6dc883c8dc4afc20f2fca046e0e7d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 2 Apr 2007 08:36:00 +0200 Subject: [PATCH 1/3] ndb - fix bug in my.cnf config handling put64 for 64-bit variables ndb/src/mgmsrv/InitConfigFileParser.cpp: put64 --- ndb/src/mgmsrv/InitConfigFileParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndb/src/mgmsrv/InitConfigFileParser.cpp b/ndb/src/mgmsrv/InitConfigFileParser.cpp index 264a998a67b..e03c5408837 100644 --- a/ndb/src/mgmsrv/InitConfigFileParser.cpp +++ b/ndb/src/mgmsrv/InitConfigFileParser.cpp @@ -658,7 +658,7 @@ InitConfigFileParser::store_in_properties(Vector& options, if (options[i].var_type == GET_INT) ctx.m_currentSection->put(options[i].name, (Uint32)value_int); else - ctx.m_currentSection->put(options[i].name, value_int); + ctx.m_currentSection->put64(options[i].name, value_int); } } return true; From d71a221d243bab6388d15d6fbb7228d365385e85 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 2 Apr 2007 09:07:15 +0200 Subject: [PATCH 2/3] ndb - bug#27581 make sure not to leave partially initialized pagerage-records ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp: make sure not to leave partially initialized pagerage-records --- ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp b/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp index 0bb7c8a1e41..e227ac8b5bf 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupPageMap.cpp @@ -453,6 +453,13 @@ Uint32 Dbtup::leafPageRangeFull(Fragrecord* const regFragPtr, PageRangePtr curr ptrCheckGuard(parentPageRangePtr, cnoOfPageRangeRec, pageRange); if (parentPageRangePtr.p->currentIndexPos < 3) { ljam(); + + if (c_noOfFreePageRanges < tiprNoLevels) + { + ljam(); + return RNIL; + }//if + /* ---------------------------------------------------------------- */ /* WE HAVE FOUND AN EMPTY ENTRY IN A PAGE RANGE RECORD. */ /* ALLOCATE A NEW PAGE RANGE RECORD, FILL IN THE START RANGE, */ From f9315b16b14f662b4d89fffcc39a3b84e6c56b51 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 2 Apr 2007 18:21:05 +0200 Subject: [PATCH 3/3] BUG#27560: Memory usage of mysqld grows while doing nothing The query-cache watch thread was continually allocating new thread entries on the THD MEM_ROOT, not freed until server exit. Fixed by using a simple array, auto-expanded as necessary. sql/ha_ndbcluster.cc: Use a fixed array (auto-expanded as necessary) for temporary copy of open shares, don't keep pushing list entries on the THD mem root. --- sql/ha_ndbcluster.cc | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 71ab1e24f4d..927dc3a75b2 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -6677,7 +6677,8 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) DBUG_RETURN(NULL); } - List util_open_tables; + uint share_list_size= 0; + NDB_SHARE **share_list= NULL; set_timespec(abstime, 0); for (;;) { @@ -6704,7 +6705,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); share->use_count++; /* Make sure the table can't be closed */ @@ -6713,14 +6729,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 it(util_open_tables); - while ((share= it++)) + /* Iterate through the open files list */ + for (i= 0; i < record_count; i++) { + share= share_list[i]; /* Split tab- and dbname */ char buf[FN_REFLEN]; char *tabname, *db; @@ -6767,10 +6783,7 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) /* 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; @@ -6793,6 +6806,8 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) } } + if (share_list) + delete [] share_list; thd->cleanup(); delete thd; delete ndb;