made diskTreeComponent more object oriented; many of its functions are now private
git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@684 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe
This commit is contained in:
parent
b298e49bad
commit
8d7199676c
6 changed files with 112 additions and 136 deletions
|
@ -161,11 +161,11 @@ pageid_t * diskTreeComponent::internalNodes::list_region_rid(int xid, void *ridp
|
|||
|
||||
recordid diskTreeComponent::internalNodes::create(int xid) {
|
||||
|
||||
tree_state = Talloc(xid,sizeof(RegionAllocConf_t));
|
||||
internal_node_alloc = Talloc(xid,sizeof(RegionAllocConf_t));
|
||||
|
||||
Tset(xid,tree_state, ®ION_ALLOC_STATIC_INITIALIZER);
|
||||
Tset(xid,internal_node_alloc, ®ION_ALLOC_STATIC_INITIALIZER);
|
||||
|
||||
pageid_t root = alloc_region_rid(xid, &tree_state);
|
||||
pageid_t root = alloc_region_rid(xid, &internal_node_alloc);
|
||||
DEBUG("Root = %lld\n", root);
|
||||
recordid ret = { root, 0, 0 };
|
||||
|
||||
|
@ -226,10 +226,15 @@ void diskTreeComponent::internalNodes::initializeNodePage(int xid, Page *p) {
|
|||
}
|
||||
|
||||
|
||||
recordid diskTreeComponent::internalNodes::appendPage(int xid, recordid tree, pageid_t & rmLeafID,
|
||||
const byte *key, size_t keySize,
|
||||
lsm_page_allocator_t allocator, void *allocator_state,
|
||||
long val_page) {
|
||||
recordid diskTreeComponent::internalNodes::appendPage(int xid,
|
||||
const byte *key, size_t keySize, pageid_t val_page) {
|
||||
recordid tree = root_rec;
|
||||
lsm_page_allocator_t allocator = alloc_region;
|
||||
diskTreeComponent::internalNodes::RegionAllocConf_t allocator_state;
|
||||
//insert the record key and id of the first page of the datapage to the diskTreeComponent
|
||||
Tread(xid,get_tree_state(), &allocator_state);
|
||||
|
||||
|
||||
Page *p = loadPage(xid, tree.page);
|
||||
writelock(p->rwlatch, 0);
|
||||
|
||||
|
@ -240,28 +245,28 @@ recordid diskTreeComponent::internalNodes::appendPage(int xid, recordid tree, pa
|
|||
int64_t depth = *((int64_t*)nr);
|
||||
stasis_record_read_done(xid, p, tree, (const byte*)nr);
|
||||
|
||||
if(rmLeafID == -1) {
|
||||
rmLeafID = findLastLeaf(xid, p, depth);
|
||||
if(lastLeaf == -1) {
|
||||
lastLeaf = findLastLeaf(xid, p, depth);
|
||||
}
|
||||
|
||||
Page *lastLeaf;
|
||||
Page *lastLeafPage;
|
||||
|
||||
if(rmLeafID != tree.page) {
|
||||
lastLeaf= loadPage(xid, rmLeafID);
|
||||
writelock(lastLeaf->rwlatch, 0);
|
||||
if(lastLeaf != tree.page) {
|
||||
lastLeafPage= loadPage(xid, lastLeaf);
|
||||
writelock(lastLeafPage->rwlatch, 0);
|
||||
} else {
|
||||
lastLeaf = p;
|
||||
lastLeafPage = p;
|
||||
}
|
||||
|
||||
recordid ret = stasis_record_alloc_begin(xid, lastLeaf,
|
||||
recordid ret = stasis_record_alloc_begin(xid, lastLeafPage,
|
||||
sizeof(indexnode_rec)+keySize);
|
||||
|
||||
if(ret.size == INVALID_SLOT) {
|
||||
if(lastLeaf->id != p->id) {
|
||||
assert(rmLeafID != tree.page);
|
||||
unlock(lastLeaf->rwlatch);
|
||||
releasePage(lastLeaf); // don't need that page anymore...
|
||||
lastLeaf = 0;
|
||||
if(lastLeafPage->id != p->id) {
|
||||
assert(lastLeaf != tree.page);
|
||||
unlock(lastLeafPage->rwlatch);
|
||||
releasePage(lastLeafPage); // don't need that page anymore...
|
||||
lastLeafPage = 0;
|
||||
}
|
||||
// traverse down the root of the tree.
|
||||
|
||||
|
@ -270,13 +275,13 @@ recordid diskTreeComponent::internalNodes::appendPage(int xid, recordid tree, pa
|
|||
assert(tree.page == p->id);
|
||||
|
||||
ret = appendInternalNode(xid, p, depth, key, keySize, val_page,
|
||||
rmLeafID == tree.page ? -1 : rmLeafID,
|
||||
allocator, allocator_state);
|
||||
lastLeaf == tree.page ? -1 : lastLeaf,
|
||||
allocator, &allocator_state);
|
||||
|
||||
if(ret.size == INVALID_SLOT) {
|
||||
DEBUG("Need to split root; depth = %d\n", depth);
|
||||
|
||||
pageid_t child = allocator(xid, allocator_state);
|
||||
pageid_t child = allocator(xid, &allocator_state);
|
||||
Page *lc = loadPage(xid, child);
|
||||
writelock(lc->rwlatch,0);
|
||||
|
||||
|
@ -328,7 +333,7 @@ recordid diskTreeComponent::internalNodes::appendPage(int xid, recordid tree, pa
|
|||
stasis_record_write_done(xid,p,pFirstSlot,(byte*)nr);
|
||||
|
||||
if(!depth) {
|
||||
rmLeafID = lc->id;
|
||||
lastLeaf = lc->id;
|
||||
pageid_t tmpid = -1;
|
||||
recordid rid = { lc->id, PREV_LEAF, root_rec_size };
|
||||
stasis_record_write(xid, lc, rid, (byte*)&tmpid);
|
||||
|
@ -347,8 +352,8 @@ recordid diskTreeComponent::internalNodes::appendPage(int xid, recordid tree, pa
|
|||
|
||||
assert(tree.page == p->id);
|
||||
ret = appendInternalNode(xid, p, depth, key, keySize, val_page,
|
||||
rmLeafID == tree.page ? -1 : rmLeafID,
|
||||
allocator, allocator_state);
|
||||
lastLeaf == tree.page ? -1 : lastLeaf,
|
||||
allocator, &allocator_state);
|
||||
|
||||
assert(ret.size != INVALID_SLOT);
|
||||
|
||||
|
@ -357,22 +362,22 @@ recordid diskTreeComponent::internalNodes::appendPage(int xid, recordid tree, pa
|
|||
depth, datatuple::key_to_str(key).c_str());
|
||||
}
|
||||
|
||||
rmLeafID = ret.page;
|
||||
DEBUG("lastleaf is %lld\n", rmLeafID);
|
||||
lastLeaf = ret.page;
|
||||
DEBUG("lastleaf is %lld\n", lastLeaf);
|
||||
|
||||
} else {
|
||||
// write the new value to an existing page
|
||||
DEBUG("Writing %s\t%d to existing page# %lld\n", datatuple::key_to_str(key).c_str(),
|
||||
val_page, lastLeaf->id);
|
||||
val_page, lastLeafPage->id);
|
||||
|
||||
stasis_record_alloc_done(xid, lastLeaf, ret);
|
||||
stasis_record_alloc_done(xid, lastLeafPage, ret);
|
||||
|
||||
writeNodeRecord(xid, lastLeaf, ret, key, keySize, val_page);
|
||||
writeNodeRecord(xid, lastLeafPage, ret, key, keySize, val_page);
|
||||
|
||||
if(lastLeaf->id != p->id) {
|
||||
assert(rmLeafID != tree.page);
|
||||
unlock(lastLeaf->rwlatch);
|
||||
releasePage(lastLeaf);
|
||||
if(lastLeafPage->id != p->id) {
|
||||
assert(lastLeaf != tree.page);
|
||||
unlock(lastLeafPage->rwlatch);
|
||||
releasePage(lastLeafPage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -381,6 +386,9 @@ recordid diskTreeComponent::internalNodes::appendPage(int xid, recordid tree, pa
|
|||
unlock(p->rwlatch);
|
||||
releasePage(p);
|
||||
|
||||
// XXX don't call tset on each page append!
|
||||
Tset(xid,get_tree_state(),&allocator_state);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -586,9 +594,9 @@ pageid_t diskTreeComponent::internalNodes::findFirstLeaf(int xid, Page *root, in
|
|||
}
|
||||
|
||||
|
||||
pageid_t diskTreeComponent::internalNodes::findPage(int xid, recordid tree, const byte *key, size_t keySize) {
|
||||
pageid_t diskTreeComponent::internalNodes::findPage(int xid, const byte *key, size_t keySize) {
|
||||
|
||||
Page *p = loadPage(xid, tree.page);
|
||||
Page *p = loadPage(xid, root_rec.page);
|
||||
readlock(p->rwlatch,0);
|
||||
|
||||
recordid depth_rid = {p->id, DEPTH, 0};
|
||||
|
|
|
@ -44,11 +44,11 @@ public:
|
|||
typedef void(*diskTreeComponent_page_deallocator_t)(int, void *);
|
||||
|
||||
|
||||
internalNodes(int xid): region_alloc(new RegionAllocator(xid, 10000)) {create(xid);} // XXX shouldn't hardcode region size.
|
||||
internalNodes(int xid, recordid root, recordid state, recordid dp_state)
|
||||
: tree_state(state),
|
||||
internalNodes(int xid): datapage_alloc(new RegionAllocator(xid, 10000)) {create(xid);} // XXX shouldn't hardcode region size.
|
||||
internalNodes(int xid, recordid root, recordid internal_node_state, recordid datapage_state)
|
||||
: internal_node_alloc(internal_node_state),
|
||||
root_rec(root),
|
||||
region_alloc(new RegionAllocator(xid, dp_state)) { lastLeaf = -1; }
|
||||
datapage_alloc(new RegionAllocator(xid, datapage_state)) { lastLeaf = -1; }
|
||||
private:
|
||||
recordid create(int xid);
|
||||
public:
|
||||
|
@ -58,42 +58,12 @@ public:
|
|||
static void deinit_stasis();
|
||||
private:
|
||||
static pageid_t alloc_region(int xid, void *conf);
|
||||
public:
|
||||
static pageid_t alloc_region_rid(int xid, void * ridp);
|
||||
static void force_region_rid(int xid, recordid rid);
|
||||
static pageid_t*list_region_rid(int xid, void * ridp,
|
||||
pageid_t * region_len, pageid_t * region_count);
|
||||
static void dealloc_region_rid(int xid, recordid rid);
|
||||
static void free_region_rid(int xid, recordid tree,
|
||||
diskTreeComponent_page_deallocator_t dealloc,
|
||||
void *allocator_state);
|
||||
|
||||
static void writeNodeRecord(int xid, Page *p, recordid &rid,
|
||||
const byte *key, size_t keylen, pageid_t ptr);
|
||||
|
||||
//return the left-most leaf, these are not data pages, although referred to as leaf
|
||||
static pageid_t findFirstLeaf(int xid, Page *root, int64_t depth);
|
||||
//return the right-most leaf
|
||||
static pageid_t findLastLeaf(int xid, Page *root, int64_t depth) ;
|
||||
|
||||
//reads the given record and returns the page id stored in it
|
||||
static pageid_t lookupLeafPageFromRid(int xid, recordid rid);
|
||||
|
||||
//returns a record that stores the pageid where the given key should be in, i.e. if it exists
|
||||
static recordid lookup(int xid, Page *node, int64_t depth, const byte *key,
|
||||
size_t keySize);
|
||||
|
||||
//returns the id of the data page that could contain the given key
|
||||
static pageid_t findPage(int xid, recordid tree, const byte *key, size_t keySize);
|
||||
|
||||
|
||||
//appends a leaf page, val_page is the id of the leaf page
|
||||
//rmLeafID --> rightmost leaf id
|
||||
static recordid appendPage(int xid, recordid tree, pageid_t & rmLeafID,
|
||||
const byte *key,size_t keySize,
|
||||
diskTreeComponent_page_allocator_t allocator, void *allocator_state,
|
||||
long val_page);
|
||||
|
||||
static recordid appendInternalNode(int xid, Page *p,
|
||||
int64_t depth,
|
||||
const byte *key, size_t key_len,
|
||||
|
@ -107,35 +77,65 @@ public:
|
|||
diskTreeComponent_page_allocator_t allocator,
|
||||
void *allocator_state);
|
||||
|
||||
inline RegionAllocator* get_alloc() { return region_alloc; }
|
||||
|
||||
/**
|
||||
Initialize a page for use as an internal node of the tree.
|
||||
*/
|
||||
inline static void initializeNodePage(int xid, Page *p);
|
||||
|
||||
recordid &get_tree_state(){return tree_state;}
|
||||
recordid &get_root_rec(){return root_rec;}
|
||||
|
||||
//return the left-most leaf, these are not data pages, although referred to as leaf
|
||||
static pageid_t findFirstLeaf(int xid, Page *root, int64_t depth);
|
||||
//return the right-most leaf
|
||||
static pageid_t findLastLeaf(int xid, Page *root, int64_t depth) ;
|
||||
|
||||
|
||||
//returns a record that stores the pageid where the given key should be in, i.e. if it exists
|
||||
static recordid lookup(int xid, Page *node, int64_t depth, const byte *key,
|
||||
size_t keySize);
|
||||
|
||||
public:
|
||||
static pageid_t alloc_region_rid(int xid, void * ridp);
|
||||
static void force_region_rid(int xid, recordid rid);
|
||||
static pageid_t*list_region_rid(int xid, void * ridp,
|
||||
pageid_t * region_len, pageid_t * region_count);
|
||||
static void dealloc_region_rid(int xid, recordid rid);
|
||||
static void free_region_rid(int xid, recordid tree,
|
||||
diskTreeComponent_page_deallocator_t dealloc,
|
||||
void *allocator_state);
|
||||
|
||||
const static RegionAllocConf_t REGION_ALLOC_STATIC_INITIALIZER;
|
||||
//returns the id of the data page that could contain the given key
|
||||
pageid_t findPage(int xid, const byte *key, size_t keySize);
|
||||
|
||||
|
||||
//appends a leaf page, val_page is the id of the leaf page
|
||||
//rmLeafID --> rightmost leaf id
|
||||
recordid appendPage(int xid,// recordid tree,
|
||||
const byte *key,size_t keySize, pageid_t val_page);
|
||||
|
||||
inline RegionAllocator* get_datapage_alloc() { return datapage_alloc; }
|
||||
|
||||
recordid &get_tree_state(){return internal_node_alloc;}
|
||||
recordid &get_root_rec(){return root_rec;}
|
||||
|
||||
private:
|
||||
const static int64_t DEPTH;
|
||||
const static int64_t COMPARATOR;
|
||||
const static int64_t FIRST_SLOT;
|
||||
const static size_t root_rec_size;
|
||||
const static int64_t PREV_LEAF;
|
||||
const static int64_t NEXT_LEAF;
|
||||
|
||||
pageid_t lastLeaf;
|
||||
public:
|
||||
const static RegionAllocConf_t REGION_ALLOC_STATIC_INITIALIZER;
|
||||
private:
|
||||
pageid_t lastLeaf;
|
||||
|
||||
void print_tree(int xid, pageid_t pid, int64_t depth);
|
||||
|
||||
recordid tree_state;
|
||||
recordid internal_node_alloc;
|
||||
recordid root_rec;
|
||||
|
||||
RegionAllocator* region_alloc;
|
||||
RegionAllocator* datapage_alloc;
|
||||
|
||||
public:
|
||||
class iterator {
|
||||
|
|
|
@ -518,13 +518,13 @@ int op_stat_space_usage(pthread_data* data) {
|
|||
pageid_t tree_c1_region_length, tree_c1_mergeable_region_length = 0, tree_c2_region_length;
|
||||
pageid_t tree_c1_region_count, tree_c1_mergeable_region_count = 0, tree_c2_region_count;
|
||||
|
||||
pageid_t * datapage_c1_regions = data->ltable->get_tree_c1()->get_alloc()->list_regions(xid, &datapage_c1_region_length, &datapage_c1_region_count);
|
||||
pageid_t * datapage_c1_regions = data->ltable->get_tree_c1()->get_datapage_alloc()->list_regions(xid, &datapage_c1_region_length, &datapage_c1_region_count);
|
||||
|
||||
pageid_t * datapage_c1_mergeable_regions = NULL;
|
||||
if(data->ltable->get_tree_c1_mergeable()) {
|
||||
datapage_c1_mergeable_regions = data->ltable->get_tree_c1_mergeable()->get_alloc()->list_regions(xid, &datapage_c1_mergeable_region_length, &datapage_c1_mergeable_region_count);
|
||||
datapage_c1_mergeable_regions = data->ltable->get_tree_c1_mergeable()->get_datapage_alloc()->list_regions(xid, &datapage_c1_mergeable_region_length, &datapage_c1_mergeable_region_count);
|
||||
}
|
||||
pageid_t * datapage_c2_regions = data->ltable->get_tree_c2()->get_alloc()->list_regions(xid, &datapage_c2_region_length, &datapage_c2_region_count);
|
||||
pageid_t * datapage_c2_regions = data->ltable->get_tree_c2()->get_datapage_alloc()->list_regions(xid, &datapage_c2_region_length, &datapage_c2_region_count);
|
||||
|
||||
recordid tree_c1_region_header = data->ltable->get_tree_c1()->get_tree_state();
|
||||
pageid_t * tree_c1_regions = diskTreeComponent::internalNodes::list_region_rid(xid, &tree_c1_region_header, &tree_c1_region_length, &tree_c1_region_count);
|
||||
|
@ -652,12 +652,12 @@ int op_dbg_blockmap(pthread_data* data) {
|
|||
// produce a list of regions used by current tree components
|
||||
pageid_t datapage_c1_region_length, datapage_c1_mergeable_region_length = 0, datapage_c2_region_length;
|
||||
pageid_t datapage_c1_region_count, datapage_c1_mergeable_region_count = 0, datapage_c2_region_count;
|
||||
pageid_t * datapage_c1_regions = data->ltable->get_tree_c1()->get_alloc()->list_regions(xid, &datapage_c1_region_length, &datapage_c1_region_count);
|
||||
pageid_t * datapage_c1_regions = data->ltable->get_tree_c1()->get_datapage_alloc()->list_regions(xid, &datapage_c1_region_length, &datapage_c1_region_count);
|
||||
pageid_t * datapage_c1_mergeable_regions = NULL;
|
||||
if(data->ltable->get_tree_c1_mergeable()) {
|
||||
datapage_c1_mergeable_regions = data->ltable->get_tree_c1_mergeable()->get_alloc()->list_regions(xid, &datapage_c1_mergeable_region_length, &datapage_c1_mergeable_region_count);
|
||||
datapage_c1_mergeable_regions = data->ltable->get_tree_c1_mergeable()->get_datapage_alloc()->list_regions(xid, &datapage_c1_mergeable_region_length, &datapage_c1_mergeable_region_count);
|
||||
}
|
||||
pageid_t * datapage_c2_regions = data->ltable->get_tree_c2()->get_alloc()->list_regions(xid, &datapage_c2_region_length, &datapage_c2_region_count);
|
||||
pageid_t * datapage_c2_regions = data->ltable->get_tree_c2()->get_datapage_alloc()->list_regions(xid, &datapage_c2_region_length, &datapage_c2_region_count);
|
||||
|
||||
pageid_t tree_c1_region_length, tree_c1_mergeable_region_length = 0, tree_c2_region_length;
|
||||
pageid_t tree_c1_region_count, tree_c1_mergeable_region_count = 0, tree_c2_region_count;
|
||||
|
|
16
logstore.cpp
16
logstore.cpp
|
@ -89,10 +89,10 @@ void logtable::openTable(int xid, recordid rid) {
|
|||
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_dp_state = tree_c2->get_datapage_alloc()->header_rid();
|
||||
tbl_header.c2_state = tree_c2->get_tree_state();
|
||||
tbl_header.c1_root = tree_c1->get_root_rec();
|
||||
tbl_header.c1_dp_state = tree_c1->get_alloc()->header_rid();
|
||||
tbl_header.c1_dp_state = tree_c1->get_datapage_alloc()->header_rid();
|
||||
tbl_header.c1_state = tree_c1->get_tree_state();
|
||||
|
||||
Tset(xid, table_rec, &tbl_header);
|
||||
|
@ -453,7 +453,7 @@ DataPage<datatuple>* logtable::insertTuple(int xid, datatuple *tuple, diskTreeCo
|
|||
int count = 0;
|
||||
while(dp==0)
|
||||
{
|
||||
dp = new DataPage<datatuple>(xid, fixed_page_count, ltree->get_alloc());
|
||||
dp = new DataPage<datatuple>(xid, fixed_page_count, ltree->get_datapage_alloc());
|
||||
|
||||
//insert the record into the data page
|
||||
if(!dp->append(tuple))
|
||||
|
@ -467,17 +467,11 @@ DataPage<datatuple>* logtable::insertTuple(int xid, datatuple *tuple, diskTreeCo
|
|||
}
|
||||
|
||||
|
||||
diskTreeComponent::internalNodes::RegionAllocConf_t alloc_conf;
|
||||
//insert the record key and id of the first page of the datapage to the diskTreeComponent
|
||||
Tread(xid,ltree->get_tree_state(), &alloc_conf);
|
||||
diskTreeComponent::internalNodes::appendPage(xid, ltree->get_root_rec(), ltree->lastLeaf,
|
||||
ltree->appendPage(xid,
|
||||
tuple->key(),
|
||||
tuple->keylen(),
|
||||
ltree->alloc_region,
|
||||
&alloc_conf,
|
||||
dp->get_start_pid()
|
||||
);
|
||||
Tset(xid,ltree->get_tree_state(),&alloc_conf);
|
||||
|
||||
|
||||
//return the datapage
|
||||
|
@ -489,7 +483,7 @@ datatuple * logtable::findTuple(int xid, datatuple::key_t key, size_t keySize,
|
|||
datatuple * tup=0;
|
||||
|
||||
//find the datapage
|
||||
pageid_t pid = ltree->findPage(xid, ltree->get_root_rec(), (byte*)key, keySize);
|
||||
pageid_t pid = ltree->findPage(xid, (byte*)key, keySize);
|
||||
|
||||
if(pid!=-1)
|
||||
{
|
||||
|
|
10
merger.cpp
10
merger.cpp
|
@ -358,7 +358,7 @@ void* memMergeThread(void*arg)
|
|||
//force write the new region to disk
|
||||
diskTreeComponent::internalNodes::force_region_rid(xid, c1_prime->get_tree_state());
|
||||
//force write the new datapages
|
||||
c1_prime->get_alloc()->force_regions(xid);
|
||||
c1_prime->get_datapage_alloc()->force_regions(xid);
|
||||
|
||||
merge_count++;
|
||||
DEBUG("mmt:\tmerge_count %lld #bytes written %lld\n", stats.merge_count, stats.bytes_out);
|
||||
|
@ -392,7 +392,7 @@ void* memMergeThread(void*arg)
|
|||
|
||||
// 12: delete old c1
|
||||
diskTreeComponent::internalNodes::dealloc_region_rid(xid, ltable->get_tree_c1()->get_tree_state());
|
||||
ltable->get_tree_c1()->get_alloc()->dealloc_regions(xid);
|
||||
ltable->get_tree_c1()->get_datapage_alloc()->dealloc_regions(xid);
|
||||
delete ltable->get_tree_c1();
|
||||
|
||||
// 11.5: delete old c0_mergeable
|
||||
|
@ -511,18 +511,18 @@ void *diskMergeThread(void*arg)
|
|||
|
||||
//5: force write the new region to disk
|
||||
diskTreeComponent::internalNodes::force_region_rid(xid, c2_prime->get_tree_state());
|
||||
c2_prime->get_alloc()->force_regions(xid);
|
||||
c2_prime->get_datapage_alloc()->force_regions(xid);
|
||||
|
||||
// (skip 6, 7, 8, 8.5, 9))
|
||||
|
||||
writelock(ltable->header_lock,0);
|
||||
//12
|
||||
diskTreeComponent::internalNodes::dealloc_region_rid(xid, ltable->get_tree_c2()->get_tree_state());
|
||||
ltable->get_tree_c2()->get_alloc()->dealloc_regions(xid);
|
||||
ltable->get_tree_c2()->get_datapage_alloc()->dealloc_regions(xid);
|
||||
delete ltable->get_tree_c2();
|
||||
//11.5
|
||||
diskTreeComponent::internalNodes::dealloc_region_rid(xid, ltable->get_tree_c1_mergeable()->get_tree_state());
|
||||
ltable->get_tree_c1_mergeable()->get_alloc()->dealloc_regions(xid);
|
||||
ltable->get_tree_c1_mergeable()->get_datapage_alloc()->dealloc_regions(xid);
|
||||
//11
|
||||
delete ltable->get_tree_c1_mergeable();
|
||||
ltable->set_tree_c1_mergeable(0);
|
||||
|
|
|
@ -44,8 +44,6 @@ void insertProbeIter_str(int NUM_ENTRIES)
|
|||
|
||||
xid = Tbegin();
|
||||
diskTreeComponent::internalNodes *lt = ltable.get_tree_c1();
|
||||
|
||||
recordid tree = lt->get_root_rec();
|
||||
|
||||
long oldpagenum = -1;
|
||||
|
||||
|
@ -73,24 +71,14 @@ void insertProbeIter_str(int NUM_ENTRIES)
|
|||
currkey[keylen-1]='\0';
|
||||
|
||||
//printf("\n#########\ni=%d\nkey:\t%s\nkeylen:%d\n",i,((char*)currkey),keylen);
|
||||
long pagenum = diskTreeComponent::internalNodes::findPage(xid, tree, currkey, keylen);
|
||||
long pagenum = lt->findPage(xid, currkey, keylen);
|
||||
//printf("pagenum:%d\n", pagenum);
|
||||
assert(pagenum == -1 || pagenum == oldpagenum || oldpagenum == -1);
|
||||
//printf("TlsmAppendPage %d\n",i);
|
||||
|
||||
recordid rid = lt->get_tree_state();
|
||||
diskTreeComponent::internalNodes::RegionAllocConf_t alloc_conf;
|
||||
Tread(xid,rid,&alloc_conf);
|
||||
|
||||
diskTreeComponent::internalNodes::appendPage(xid, tree, lt->lastLeaf, currkey, keylen, lt->alloc_region, &alloc_conf, i + OFFSET);
|
||||
lt->appendPage(xid, currkey, keylen, i + OFFSET);
|
||||
|
||||
//DEBUG("{%lld <- alloc region extend}\n", conf.regionList.page);
|
||||
// XXX get rid of Tset by storing next page in memory, and losing it
|
||||
// on crash.
|
||||
Tset(xid,rid,&alloc_conf);
|
||||
|
||||
|
||||
pagenum = diskTreeComponent::internalNodes::findPage(xid, tree, currkey,keylen);
|
||||
pagenum = lt->findPage(xid, currkey,keylen);
|
||||
oldpagenum = pagenum;
|
||||
//printf("pagenum:%d\n", pagenum);
|
||||
assert(pagenum == i + OFFSET);
|
||||
|
@ -101,7 +89,6 @@ void insertProbeIter_str(int NUM_ENTRIES)
|
|||
|
||||
printf("Writes complete.");
|
||||
|
||||
tree = lt->get_root_rec();
|
||||
Tcommit(xid);
|
||||
xid = Tbegin();
|
||||
|
||||
|
@ -118,7 +105,7 @@ void insertProbeIter_str(int NUM_ENTRIES)
|
|||
currkey[keylen-1]='\0';
|
||||
|
||||
//printf("\n#########\ni=%d\nkey:\t%s\nkeylen:%d\n",i,((char*)currkey),keylen);
|
||||
long pagenum = diskTreeComponent::internalNodes::findPage(xid, tree, currkey, keylen);
|
||||
long pagenum = lt->findPage(xid, currkey, keylen);
|
||||
//printf("pagenum:%d\n", pagenum);
|
||||
assert(pagenum == i + OFFSET);
|
||||
free(currkey);
|
||||
|
@ -129,7 +116,7 @@ void insertProbeIter_str(int NUM_ENTRIES)
|
|||
|
||||
|
||||
int64_t count = 0;
|
||||
diskTreeComponent::internalNodes::iterator * it = new diskTreeComponent::internalNodes::iterator(xid, tree);
|
||||
diskTreeComponent::internalNodes::iterator * it = new diskTreeComponent::internalNodes::iterator(xid, lt->get_root_rec());
|
||||
|
||||
while(it->next()) {
|
||||
byte * key;
|
||||
|
@ -178,8 +165,6 @@ void insertProbeIter_int(int NUM_ENTRIES)
|
|||
|
||||
xid = Tbegin();
|
||||
diskTreeComponent::internalNodes *lt = ltable.get_tree_c1();
|
||||
|
||||
recordid tree = lt->get_root_rec();
|
||||
|
||||
long oldpagenum = -1;
|
||||
|
||||
|
@ -190,24 +175,14 @@ void insertProbeIter_int(int NUM_ENTRIES)
|
|||
//currkey[]='\0';
|
||||
|
||||
printf("\n#########\ni=%d\nkey:\t%d\nkeylen:%d\n",i,*((int32_t*)currkey),keylen);
|
||||
pageid_t pagenum = diskTreeComponent::internalNodes::findPage(xid, tree, currkey, keylen);
|
||||
pageid_t pagenum = lt->findPage(xid, currkey, keylen);
|
||||
printf("pagenum:%lld\n", (long long)pagenum);
|
||||
assert(pagenum == -1 || pagenum == oldpagenum || oldpagenum == -1);
|
||||
printf("TlsmAppendPage %d\n",i);
|
||||
|
||||
recordid rid = lt->get_tree_state();
|
||||
diskTreeComponent::internalNodes::RegionAllocConf_t alloc_conf;
|
||||
Tread(xid,rid,&alloc_conf);
|
||||
|
||||
diskTreeComponent::internalNodes::appendPage(xid, tree, lt->lastLeaf, currkey, keylen, lt->alloc_region, &alloc_conf, i + OFFSET);
|
||||
lt->appendPage(xid, currkey, keylen, i + OFFSET);
|
||||
|
||||
//DEBUG("{%lld <- alloc region extend}\n", conf.regionList.page);
|
||||
// XXX get rid of Tset by storing next page in memory, and losing it
|
||||
// on crash.
|
||||
Tset(xid,rid,&alloc_conf);
|
||||
|
||||
|
||||
pagenum = diskTreeComponent::internalNodes::findPage(xid, tree, currkey,keylen);
|
||||
pagenum = lt->findPage(xid, currkey,keylen);
|
||||
oldpagenum = pagenum;
|
||||
printf("pagenum:%lld\n", (long long)pagenum);
|
||||
assert(pagenum == i + OFFSET);
|
||||
|
@ -216,7 +191,6 @@ void insertProbeIter_int(int NUM_ENTRIES)
|
|||
|
||||
printf("Writes complete.");
|
||||
|
||||
tree = lt->get_root_rec();
|
||||
Tcommit(xid);
|
||||
xid = Tbegin();
|
||||
|
||||
|
@ -229,7 +203,7 @@ void insertProbeIter_int(int NUM_ENTRIES)
|
|||
memcpy(currkey, (byte*)(&i), keylen);
|
||||
|
||||
printf("\n#########\ni=%d\nkey:\t%d\nkeylen:%d\n",i,*((int32_t*)currkey),keylen);
|
||||
pageid_t pagenum = diskTreeComponent::internalNodes::findPage(xid, tree, currkey, keylen);
|
||||
pageid_t pagenum = lt->findPage(xid, currkey, keylen);
|
||||
printf("pagenum:%lld\n", (long long) pagenum);
|
||||
assert(pagenum == i + OFFSET);
|
||||
free(currkey);
|
||||
|
|
Loading…
Reference in a new issue