diff --git a/logstore.cpp b/logstore.cpp index 53b4ccf..e06093c 100644 --- a/logstore.cpp +++ b/logstore.cpp @@ -48,7 +48,6 @@ logtable::logtable() epoch = 0; } - void logtable::tearDownTree(rbtree_ptr_t tree) { datatuple * t = 0; rbtree_t::iterator old; @@ -92,14 +91,18 @@ recordid logtable::allocTable(int xid) table_rec = Talloc(xid, sizeof(tbl_header)); //create the big tree - tbl_header.c2_dp_state = Talloc(xid, DataPage::RegionAllocator::header_size); tree_c2 = new diskTreeComponent(xid); //create the small tree - tbl_header.c1_dp_state = Talloc(xid, DataPage::RegionAllocator::header_size); tree_c1 = new diskTreeComponent(xid); - - tbl_header.c2_root = tree_c2->get_root_rec(); + + update_persistent_header(xid); + + return table_rec; +} +void logtable::update_persistent_header(int xid) { + + tbl_header.c2_root = tree_c2->get_root_rec(); tbl_header.c2_dp_state = tree_c2->get_alloc()->header_rid(); tbl_header.c2_state = tree_c2->get_tree_state(); tbl_header.c1_root = tree_c1->get_root_rec(); @@ -107,8 +110,6 @@ recordid logtable::allocTable(int xid) tbl_header.c1_state = tree_c1->get_tree_state(); Tset(xid, table_rec, &tbl_header); - - return table_rec; } void logtable::flushTable() @@ -540,6 +541,4 @@ void logtable::bump_epoch() { } } - - template class logtableIterator; diff --git a/logstore.h b/logstore.h index 6d67455..8caa0ae 100644 --- a/logstore.h +++ b/logstore.h @@ -91,6 +91,8 @@ public: void set_tree_c0(rbtree_ptr_t newtree){tree_c0 = newtree; bump_epoch(); } void set_tree_c0_mergeable(rbtree_ptr_t newtree){tree_c0_mergeable = newtree; bump_epoch(); } + void update_persistent_header(int xid); + int get_fixed_page_count(){return fixed_page_count;} void set_fixed_page_count(int count){fixed_page_count = count;} diff --git a/merger.cpp b/merger.cpp index 3a94362..e3360c7 100644 --- a/merger.cpp +++ b/merger.cpp @@ -344,10 +344,9 @@ void* memMergeThread(void*arg) ltable->set_tree_c1(c1_prime); } - // XXX want to set this stuff somewhere. - logtable::table_header h; printf("mmt:\tUpdated C1's position on disk to %lld\n",ltable->get_tree_c1()->get_root_rec().page); // 13 + ltable->update_persistent_header(xid); Tcommit(xid); unlock(ltable->header_lock); @@ -465,10 +464,9 @@ void *diskMergeThread(void*arg) // 10: C2 is never to big ltable->set_tree_c2(c2_prime); - logtable::table_header h; // XXX Need to set header. - printf("dmt:\tUpdated C2's position on disk to %lld\n",(long long)-1); // 13 + ltable->update_persistent_header(xid); Tcommit(xid); unlock(ltable->header_lock);