Commit f293366d authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Fix the undersized buffer pool problem. Fixes #632. Addresses #580.

git-svn-id: file:///svn/tokudb@3237 c7de825b-a66e-492c-adef-691d508d4ae1
parent 02e06678
...@@ -256,7 +256,7 @@ int malloc_diskblock (DISKOFF *res, BRT brt, int size, TOKULOGGER logger) { ...@@ -256,7 +256,7 @@ int malloc_diskblock (DISKOFF *res, BRT brt, int size, TOKULOGGER logger) {
} }
u_int32_t mp_pool_size_for_nodesize (u_int32_t nodesize) { u_int32_t mp_pool_size_for_nodesize (u_int32_t nodesize) {
#if 0 #if 1
return nodesize+nodesize/4; return nodesize+nodesize/4;
#else #else
return nodesize; return nodesize;
...@@ -287,9 +287,10 @@ static void initialize_brtnode (BRT t, BRTNODE n, DISKOFF nodename, int height) ...@@ -287,9 +287,10 @@ static void initialize_brtnode (BRT t, BRTNODE n, DISKOFF nodename, int height)
int r = toku_gpma_create(&n->u.l.buffer, 0); int r = toku_gpma_create(&n->u.l.buffer, 0);
assert(r==0); assert(r==0);
{ {
void *mp = toku_malloc(n->nodesize); u_int32_t mpsize = mp_pool_size_for_nodesize(n->nodesize);
void *mp = toku_malloc(mpsize);
assert(mp); assert(mp);
toku_mempool_init(&n->u.l.buffer_mempool, mp, mp_pool_size_for_nodesize(n->nodesize)); toku_mempool_init(&n->u.l.buffer_mempool, mp, mpsize);
} }
static int rcount=0; static int rcount=0;
......
...@@ -45,5 +45,6 @@ int main (int argc, const char *argv[]) { ...@@ -45,5 +45,6 @@ int main (int argc, const char *argv[]) {
verbose = 0; verbose = 0;
} }
test_overflow(); test_overflow();
toku_malloc_cleanup();
return 0; return 0;
} }
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