From e545f2d3809960ddff9b3335443c4dad0301ea04 Mon Sep 17 00:00:00 2001 From: Yoni Fogel Date: Wed, 17 Apr 2013 00:00:57 -0400 Subject: [PATCH] refs #5197 Fix a couple of bugs (off by true, and missing braces around if statement) with not reserving memory for put-loader Also only call toku_txn_require_checkpoint_on_commit(tokutxn) once (instead of N times) git-svn-id: file:///svn/toku/tokudb@45351 c7de825b-a66e-492c-adef-691d508d4ae1 --- ft/ftloader.c | 3 ++- src/indexer.c | 12 +++++------- src/loader.c | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ft/ftloader.c b/ft/ftloader.c index 49188ff6672..d2701d06bd2 100644 --- a/ft/ftloader.c +++ b/ft/ftloader.c @@ -374,9 +374,10 @@ void toku_ft_loader_internal_destroy (FTLOADER bl, BOOL is_error) { toku_free(bl->fractal_queues); toku_free(bl->fractal_threads_live); - if (bl->did_reserve_memory) + if (bl->did_reserve_memory) { invariant(bl->cachetable); toku_cachetable_release_reserved_memory(bl->cachetable, bl->reserved_memory); + } ft_loader_destroy_error_callback(&bl->error_callback); ft_loader_destroy_poll_callback(&bl->poll_callback); diff --git a/src/indexer.c b/src/indexer.c index 35bf3263cb1..b0a03826b6f 100644 --- a/src/indexer.c +++ b/src/indexer.c @@ -479,20 +479,18 @@ build_index(DB_INDEXER *indexer) { } // Clients must not operate on any of the hot dbs concurrently with close -static int +static int close_indexer(DB_INDEXER *indexer) { int r = 0; (void) __sync_fetch_and_sub(&STATUS_VALUE(INDEXER_CURRENT), 1); - // Mark txn as needing a checkpoint. - // (This will cause a checkpoint, which is necessary - // because these files are not necessarily on disk and all the operations + // Mark txn as needing a checkpoint. + // (This will cause a checkpoint, which is necessary + // because these files are not necessarily on disk and all the operations // to create them are not in the recovery log.) DB_TXN *txn = indexer->i->txn; TOKUTXN tokutxn = db_txn_struct_i(txn)->tokutxn; - for (int which_db = 0; which_db < indexer->i->N ; which_db++) { - toku_txn_require_checkpoint_on_commit(tokutxn); - } + toku_txn_require_checkpoint_on_commit(tokutxn); // Disassociate the indexer from the hot db and free_indexer disassociate_indexer_from_hot_dbs(indexer); diff --git a/src/loader.c b/src/loader.c index 18a4c9cea63..6594406169d 100644 --- a/src/loader.c +++ b/src/loader.c @@ -274,7 +274,7 @@ int toku_loader_create_loader(DB_ENV *env, loader->i->temp_file_template, load_lsn, ttxn, - use_puts); + !use_puts); if ( r!=0 ) { toku_free(new_inames_in_env); toku_free(brts);