Implemented (but did not test) header update.
git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@650 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe
This commit is contained in:
parent
2d44b6beed
commit
27720dddbe
3 changed files with 12 additions and 13 deletions
15
logstore.cpp
15
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<datatuple>::RegionAllocator::header_size);
|
||||
tree_c2 = new diskTreeComponent(xid);
|
||||
|
||||
//create the small tree
|
||||
tbl_header.c1_dp_state = Talloc(xid, DataPage<datatuple>::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<datatuple>;
|
||||
|
|
|
@ -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;}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue