diff --git a/src/stasis/operations/lsmIterators.h b/src/stasis/operations/lsmIterators.h index 23b9d10..ff5772b 100644 --- a/src/stasis/operations/lsmIterators.h +++ b/src/stasis/operations/lsmIterators.h @@ -454,9 +454,7 @@ class versioningIterator { it_ = i.it_; itend_ = i.itend_; } - // inline unsigned int offset() { return off_; } private: - // unsigned int off_; STLITER it_; STLITER itend_; friend const byte* diff --git a/src/stasis/operations/lsmTable.h b/src/stasis/operations/lsmTable.h index e6ae5a9..604b8e4 100644 --- a/src/stasis/operations/lsmTable.h +++ b/src/stasis/operations/lsmTable.h @@ -62,6 +62,7 @@ namespace rose { } pageCount++; + stasis_page_cleanup(p); typename PAGELAYOUT::FMT * mc = PAGELAYOUT::initPage(p, &**begin); for(ITER i(*begin); i != *end; ++i) { @@ -198,7 +199,7 @@ namespace rose { pageid_t mergedPages = compressData , typename PAGELAYOUT::FMT::TUP> > - (xid, &vBegin, &vEnd,tree->r_,a->pageAlloc,a->pageAllocState,&insertedTuples); + (xid, &vBegin, &vEnd,tree->r_,a->pageAlloc,a->pageAllocState,&insertedTuples); /* pageid_t mergedPages = compressData > (xid, &mBegin, &mEnd,tree->r_,a->pageAlloc,a->pageAllocState,&insertedTuples); */ @@ -236,8 +237,17 @@ namespace rose { // TlsmFree(xid, ((typename ITERB::handle)old_in_tree)->r_,TlsmRegionDeallocRid,a->in_tree_allocer); // XXX kludge; assumes C1 and C2 have same type of handle.... TlsmFree(xid, ((typename ITERA::handle)old_in_tree)->r_,TlsmRegionDeallocRid,a->in_tree_allocer); + delete old_in_tree; + } else { + ((typename stlSetIterator, + typename PAGELAYOUT::FMT::TUP>::handle)old_in_tree)->clear(); + delete + ((typename stlSetIterator, + typename PAGELAYOUT::FMT::TUP>::handle)old_in_tree); } - delete old_in_tree; + free(*a->in_tree); // free pointer to handle // XXX should we delay this to this point? @@ -526,6 +536,7 @@ namespace rose { template void TlsmTableStop( lsmTableHandle * h) { TlsmTableFlush(h); + delete(h->scratch_handle); *(h->still_open) = 0; pthread_join(h->merge1_thread,0); pthread_join(h->merge2_thread,0); diff --git a/src/stasis/page/compression/staticMulticolumn.h b/src/stasis/page/compression/staticMulticolumn.h index 41a0fe3..cbf7d34 100644 --- a/src/stasis/page/compression/staticMulticolumn.h +++ b/src/stasis/page/compression/staticMulticolumn.h @@ -97,7 +97,7 @@ class StaticMulticolumn { exceptions_(new byte[USABLE_SIZE_OF_PAGE]), unpacked_(1) { - + stasis_page_cleanup(p); *column_count_ptr() = N; bytes_left_ = first_header_byte_ptr()- p->memAddr; @@ -106,7 +106,7 @@ class StaticMulticolumn { if(i < N) { \ columns_[i] = new byte[USABLE_SIZE_OF_PAGE]; \ cmp = new typ(xid,(void*)columns_[i]); \ - cmp->init_mem(columns_[i]); \ + cmp->init_mem(columns_[i]); \ *column_plugin_id_ptr(i) = cmp->PLUGIN_ID; \ bytes_left_ -= cmp->bytes_used(); \ } @@ -127,7 +127,7 @@ class StaticMulticolumn { #define STATIC_MC_DEINIT(i,plug) \ if(i < N) { \ if(unpacked_) delete [] columns_[i]; \ - delete plug; \ + delete plug; \ } STATIC_MC_DEINIT(0,plugin0); @@ -501,7 +501,6 @@ template static void staticMulticolumnCleanup(Page *p) { - // printf("cleanup %d\n", N); fflush(stdout); delete (StaticMulticolumn*)p->impl; p->impl = 0; } diff --git a/src/stasis/page/fixed.c b/src/stasis/page/fixed.c index 32b1211..02ead3b 100644 --- a/src/stasis/page/fixed.c +++ b/src/stasis/page/fixed.c @@ -14,6 +14,7 @@ void stasis_fixed_initialize_page(Page * page, size_t size, int count) { assertlocked(page->rwlatch); // XXX fixed page asserts it's been given an UNINITIALIZED_PAGE... Why doesn't that crash? // assert(*stasis_page_type_ptr(page) == UNINITIALIZED_PAGE); + stasis_page_cleanup(page); *stasis_page_type_ptr(page) = FIXED_PAGE; *recordsize_ptr(page) = size; assert(count <= stasis_fixed_records_per_page(size)); diff --git a/src/stasis/page/header.c b/src/stasis/page/header.c index dc2f986..f08c0e2 100644 --- a/src/stasis/page/header.c +++ b/src/stasis/page/header.c @@ -15,6 +15,7 @@ int headerPageInitialize() { if(*page_type_ptr(p) != LLADD_HEADER_PAGE) { assert(*page_type_ptr(p) == 0) ; memset(p->memAddr, 0, PAGE_SIZE); + stasis_page_cleanup(p); *page_type_ptr(p) = LLADD_HEADER_PAGE; *headerFreepage_ptr(p) = 1; *headerFreepagelist_ptr(p) = 0; diff --git a/src/stasis/page/indirect.c b/src/stasis/page/indirect.c index a15b0da..093cabf 100644 --- a/src/stasis/page/indirect.c +++ b/src/stasis/page/indirect.c @@ -10,6 +10,7 @@ void indirectInitialize(Page * p, int height) { *level_ptr(p) = height; + stasis_page_cleanup(p); *stasis_page_type_ptr(p) = INDIRECT_PAGE; memset(p->memAddr, INVALID_SLOT, ((size_t)level_ptr(p)) - ((size_t)p->memAddr)); } diff --git a/src/stasis/page/slotted.c b/src/stasis/page/slotted.c index 91f32d3..c3133b0 100644 --- a/src/stasis/page/slotted.c +++ b/src/stasis/page/slotted.c @@ -195,6 +195,7 @@ void slottedPageDeinit() { void stasis_slotted_initialize_page(Page * page) { assertlocked(page->rwlatch); + stasis_page_cleanup(page); *stasis_page_type_ptr(page) = SLOTTED_PAGE; *freespace_ptr(page) = 0; *numslots_ptr(page) = 0;