move the internal node region allocator stuff into diskTreeComponent::internalNode

git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@681 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe
This commit is contained in:
sears 2010-03-09 20:23:15 +00:00
parent 01c65d7a3c
commit 54e73ab803
7 changed files with 24 additions and 25 deletions

View file

@ -23,7 +23,7 @@
// LOGTREE implementation
/////////////////////////////////////////////////////////////////
const RegionAllocConf_t diskTreeComponent::internalNodes::REGION_ALLOC_STATIC_INITIALIZER = { {0,0,-1}, 0, -1, -1, 1000 };
const diskTreeComponent::internalNodes::RegionAllocConf_t diskTreeComponent::internalNodes::REGION_ALLOC_STATIC_INITIALIZER = { {0,0,-1}, 0, -1, -1, 1000 };
//LSM_ROOT_PAGE

View file

@ -22,6 +22,14 @@
#include "tuplemerger.h"
#include "datatuple.h"
class diskTreeComponent {
public:
class internalNodes{
public:
struct indexnode_rec {
pageid_t ptr;
};
typedef struct RegionAllocConf_t
{
@ -32,17 +40,10 @@ typedef struct RegionAllocConf_t
pageid_t regionSize;
} RegionAllocConf_t;
struct indexnode_rec {
pageid_t ptr;
};
typedef pageid_t(*diskTreeComponent_page_allocator_t)(int, void *);
typedef void(*diskTreeComponent_page_deallocator_t)(int, void *);
class diskTreeComponent {
public:
class internalNodes{
public:
internalNodes(int xid): region_alloc(new DataPage<datatuple>::RegionAllocator(xid, 10000)) {create(xid);} // XXX shouldn't hardcode region size.
internalNodes(int xid, recordid root, recordid state, recordid dp_state)
: tree_state(state),

View file

@ -467,7 +467,7 @@ DataPage<datatuple>* logtable::insertTuple(int xid, datatuple *tuple, diskTreeCo
}
RegionAllocConf_t alloc_conf;
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,

View file

@ -107,7 +107,7 @@ public:
recordid c1_dp_state;
};
const static RegionAllocConf_t DATAPAGE_REGION_ALLOC_STATIC_INITIALIZER;
const static diskTreeComponent::internalNodes::RegionAllocConf_t DATAPAGE_REGION_ALLOC_STATIC_INITIALIZER;
logtable_mergedata * mergedata;
rwl * header_lock;

View file

@ -51,7 +51,7 @@ void insertProbeIter(size_t NUM_ENTRIES)
DataPage<datatuple>::RegionAllocator * alloc
= new DataPage<datatuple>::RegionAllocator(xid, 10000); // ~ 10 datapages per region.
recordid alloc_state = Talloc(xid,sizeof(RegionAllocConf_t));
recordid alloc_state = Talloc(xid,sizeof(diskTreeComponent::internalNodes::RegionAllocConf_t));
Tset(xid,alloc_state, &diskTreeComponent::internalNodes::REGION_ALLOC_STATIC_INITIALIZER);

View file

@ -79,7 +79,7 @@ void insertProbeIter_str(int NUM_ENTRIES)
//printf("TlsmAppendPage %d\n",i);
recordid rid = lt->get_tree_state();
RegionAllocConf_t alloc_conf;
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);
@ -196,7 +196,7 @@ void insertProbeIter_int(int NUM_ENTRIES)
printf("TlsmAppendPage %d\n",i);
recordid rid = lt->get_tree_state();
RegionAllocConf_t alloc_conf;
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);

View file

@ -50,8 +50,6 @@ void insertProbeIter(size_t NUM_ENTRIES)
printf("size partition %d is %d\n", i+1, key_arr->size());
}
key_v_t * key_arr = new key_v_t;
std::vector<key_v_t::iterator*> iters;