From 91273d2f438cb3c11a462a6f3dbd10f699af5966 Mon Sep 17 00:00:00 2001 From: sears Date: Tue, 16 Feb 2010 00:44:13 +0000 Subject: [PATCH] removed alloc state from merger_args; space reclamation now seems to be working, modulo ArrayList leaks git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@563 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe --- datapage.h | 2 +- logstore.cpp | 4 ---- merger.cpp | 20 +++----------------- merger.h | 2 -- 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/datapage.h b/datapage.h index 6b4b72d..51447cf 100644 --- a/datapage.h +++ b/datapage.h @@ -7,7 +7,7 @@ #include -#define CHECK_FOR_SCRIBBLING +//#define CHECK_FOR_SCRIBBLING template class DataPage diff --git a/logstore.cpp b/logstore.cpp index 2601b62..8e81154 100644 --- a/logstore.cpp +++ b/logstore.cpp @@ -26,10 +26,6 @@ static inline double tv_to_double(struct timeval tv) ///////////////////////////////////////////////////////////////// const RegionAllocConf_t logtree::REGION_ALLOC_STATIC_INITIALIZER = { {0,0,-1}, 0, -1, -1, 1000 }; -const RegionAllocConf_t -logtable::DATAPAGE_REGION_ALLOC_STATIC_INITIALIZER = { {0,0,-1}, 0, -1, -1, 1000 }; - -//printf(__VA_ARGS__); fflush(NULL) #define LOGTREE_ROOT_PAGE SLOTTED_PAGE diff --git a/merger.cpp b/merger.cpp index d77f084..36336ad 100644 --- a/merger.cpp +++ b/merger.cpp @@ -4,10 +4,6 @@ #include "logiterators.cpp" #include "datapage.h" -//pageid_t merge_scheduler::C0_MEM_SIZE = 1000 * 1000 * 1000; - -//template <> struct merger_args; -//template <> struct merger_args; inline DataPage* insertTuple(int xid, DataPage *dp, datatuple *t, logtable *ltable, @@ -166,8 +162,6 @@ void merge_scheduler::startlogtable(int index, int64_t MAX_C0_SIZE) *block1_scratch=0; //recordid * allocer_scratch = new recordid; - RegionAllocConf_t *allocer_scratch = new RegionAllocConf_t; - struct merger_args diskmerge_args= { ltable, @@ -188,9 +182,7 @@ void merge_scheduler::startlogtable(int index, int64_t MAX_C0_SIZE) 0, //max_tree_size No max size for biggest component &R, //r_i block1_scratch, //in-tree - allocer_scratch, //in_tree_allocer 0, //out_tree - 0, //out_tree_allocer ltable->get_tree_c2()->get_root_rec(), // my_tree ltable->get_table_rec() //tree }; @@ -228,9 +220,7 @@ void merge_scheduler::startlogtable(int index, int64_t MAX_C0_SIZE) (int64_t)(R * R * MAX_C0_SIZE), &R, mdata->old_c0, - 0, block1_scratch, - allocer_scratch, ltable->get_tree_c1()->get_root_rec(), ltable->get_table_rec() //tree }; @@ -325,13 +315,10 @@ void* memMergeThread(void*arg) recordid scratch_root = scratch_tree->create(xid); //save the old dp state values - // RegionAllocConf_t olddp_state; - // Tread(xid, ltable->get_dpstate1(), &olddp_state); DataPage::RegionAllocator *old_alloc = ltable->get_tree_c1()->get_alloc(); old_alloc->done(); // XXX do this earlier //reinitialize the dp state scratch_tree->set_alloc(new DataPage::RegionAllocator(xid, ltable->get_dpstate1() /*rid of old header*/, 10000)); // XXX should not hardcode region size -// Tset(xid, ltable->get_dpstate1(), &logtable::DATAPAGE_REGION_ALLOC_STATIC_INITIALIZER); //pthread_mutex_unlock(a->block_ready_mut); unlock(ltable->mergedata->header_lock); @@ -347,14 +334,13 @@ void* memMergeThread(void*arg) //force write the new region to disk recordid scratch_alloc_state = scratch_tree->get_tree_state(); - //TlsmForce(xid,scratch_root,logtree::force_region_rid, &scratch_alloc_state); // XXX When called by merger_check (at least), we hold a pin on a page that should be forced. This causes stasis to abort() the process. logtree::force_region_rid(xid, &scratch_alloc_state); //force write the new datapages scratch_tree->get_alloc()->force_regions(xid); //writes complete - //now automically replace the old c1 with new c1 + //now atomically replace the old c1 with new c1 //pthread_mutex_lock(a->block_ready_mut); writelock(ltable->mergedata->header_lock,0); @@ -414,7 +400,7 @@ void* memMergeThread(void*arg) *a->out_tree = scratch_tree; xid = Tbegin(); - Tread(xid, ltable->get_dpstate1(), a->out_tree_allocer); +// Tread(xid, ltable->get_dpstate1(), a->out_tree_allocer); pthread_cond_signal(a->out_block_ready_cond); @@ -435,7 +421,7 @@ void* memMergeThread(void*arg) printf("mmt:\tUpdated C1's position on disk to %lld\n",empty_tree->get_root_rec().page); Tset(xid, a->tree, &h); //update datapage alloc state - Tset(xid, ltable->get_dpstate1(), &logtable::DATAPAGE_REGION_ALLOC_STATIC_INITIALIZER); + ltable->get_tree_c1()->set_alloc(new DataPage::RegionAllocator(xid, ltable->get_dpstate1() /*rid of old header*/, 10000)); // XXX should not hardcode region size Tcommit(xid); //xid = Tbegin(); diff --git a/merger.h b/merger.h index c17e478..fc0eee7 100644 --- a/merger.h +++ b/merger.h @@ -41,10 +41,8 @@ struct merger_args double * r_i; T ** in_tree; - void * in_tree_allocer; logtree ** out_tree; - void * out_tree_allocer; recordid my_tree;