From: Date: March 8 2007 3:42pm Subject: bk commit into 5.1 tree (jonas:1.2457) List-Archive: http://lists.mysql.com/commits/21504 Message-Id: <20070308144251.E4C6E727B19@perch.ndb.mysql.com> Below is the list of changes that have just been committed into a local 5.1 repository of jonas. When jonas 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-03-08 15:42:46+01:00, jonas@stripped +1 -0 Merge perch.ndb.mysql.com:/home/jonas/src/51-telco into perch.ndb.mysql.com:/home/jonas/src/kjk MERGE: 1.2453.1.3 storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp@stripped, 2007-03-08 15:42:43+01:00, jonas@stripped +0 -0 Auto merged MERGE: 1.13.1.1 # 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: jonas # Host: perch.ndb.mysql.com # Root: /home/jonas/src/kjk/RESYNC --- 1.14/storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp 2007-03-08 15:42:51 +01:00 +++ 1.15/storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp 2007-03-08 15:42:51 +01:00 @@ -25,16 +25,11 @@ extern EventLogger g_eventLogger; #endif -#ifdef NDBD_MALLOC_METHOD -#if NDBD_MALLOC_METHOD == sbrk -static const char * f_method = "sbrk"; +static int f_method_idx = 0; +#ifdef NDBD_MALLOC_METHOD_SBRK +static const char * f_method = "SMsm"; #else -static const char * f_method = "malloc"; -#endif -#elif SIZEOF_CHARP == 8 -static const char * f_method = "sbrk"; -#else -static const char * f_method = "malloc"; +static const char * f_method = "MSms"; #endif #define MAX_CHUNKS 10 @@ -54,28 +49,42 @@ pages += 1; void * ptr = 0; Uint32 sz = pages; - if (strcmp(f_method, "sbrk") == 0) + +retry: + char method = f_method[f_method_idx]; + switch(method){ + case 0: + return false; + case 'S': + case 's': { ptr = 0; while (ptr == 0) { ptr = sbrk(sizeof(Alloc_page) * sz); + if (ptr == (void*)-1) { + if (method == 'S') + { + f_method_idx++; + goto retry; + } + ptr = 0; sz = 1 + (9 * sz) / 10; if (pages >= 32 && sz < 32) { sz = pages; - f_method = "malloc"; - g_eventLogger.info("sbrk(%lld) failed, trying malloc", - (Uint64)(sizeof(Alloc_page) * sz)); - break; + f_method_idx++; + goto retry; } } } + break; } - if (strcmp(f_method, "malloc") == 0) + case 'M': + case 'm': { ptr = 0; while (ptr == 0) @@ -83,15 +92,26 @@ ptr = malloc(sizeof(Alloc_page) * sz); if (ptr == 0) { + if (method == 'M') + { + f_method_idx++; + goto retry; + } + sz = 1 + (9 * sz) / 10; if (pages >= 32 && sz < 32) { - return false; + f_method_idx++; + goto retry; } } } + break; } - + default: + return false; + } + chunk->m_cnt = sz; chunk->m_ptr = (Alloc_page*)ptr; const UintPtr align = sizeof(Alloc_page) - 1; @@ -363,30 +383,39 @@ cnt--; // last page is always marked as empty } - if (!m_used_bitmap_pages.get(start_bmp)) + for (Uint32 i = 0; i> (20 - 15))); + g_eventLogger.error("ndbd_malloc_impl.cpp:%d:grow(%d, %d) not using %uMb" + " - Unable to use due to bitmap pages missaligned!!", + __LINE__, start, cnt, + (cnt >> (20 - 15))); + dump(); + return; + } + #ifdef UNIT_TEST - ndbout_c("creating bitmap page %d", start_bmp); + ndbout_c("creating bitmap page %d", start_bmp); #endif - + + { Alloc_page* bmp = m_base_page + start; memset(bmp, 0, sizeof(Alloc_page)); - m_used_bitmap_pages.set(start_bmp); cnt--; start++; } - + m_used_bitmap_pages.push_back(start_bmp); + +found: if (cnt) { m_resource_limit[0].m_curr += cnt; @@ -588,6 +617,15 @@ } printf("EOL\n"); } + + for (Uint32 i = 0; i; #endif + +template class Vector;