add --test argument to server, fix segfault due to scans with empty c0_mergeable

git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@699 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe
This commit is contained in:
sears 2010-03-17 23:45:41 +00:00
parent e1c937a602
commit ead6207f86
3 changed files with 32 additions and 31 deletions

View file

@ -44,7 +44,11 @@ class diskTreeComponent {
return new iterator(ltree);
}
iterator * open_iterator(datatuple * key) {
return new iterator(ltree, key);
if(key != NULL) {
return new iterator(ltree, key);
} else {
return new iterator(ltree);
}
}
void force(int xid);

View file

@ -142,7 +142,7 @@ public:
current_[0] = first_iter_->getnext();
for(int i = 1; i < num_iters_; i++) {
iters_[i-1] = iters[i-1];
current_[i] = iters_[i-1]->next_callerFrees();
current_[i] = iters_[i-1] ? iters_[i-1]->next_callerFrees() : NULL;
}
}
~mergeManyIterator() {
@ -338,26 +338,26 @@ public:
typename memTreeComponent<TUPLE>::iterator *c0_mergeable_it[1];
diskTreeComponent::iterator * disk_it[3];
epoch = ltable->get_epoch();
datatuple *t;
if(last_returned) {
c0_it = new typename memTreeComponent<TUPLE>::revalidatingIterator(ltable->get_tree_c0(), ltable->getMergeData()->rbtree_mut, last_returned);
c0_mergeable_it[0] = new typename memTreeComponent<TUPLE>::iterator (ltable->get_tree_c0_mergeable(), last_returned);
disk_it[0] = ltable->get_tree_c1()->open_iterator(last_returned);
disk_it[1] = ltable->get_tree_c1_mergeable()->open_iterator(last_returned);
disk_it[2] = ltable->get_tree_c2()->open_iterator(last_returned);
t = last_returned;
} else if(key) {
c0_it = new typename memTreeComponent<TUPLE>::revalidatingIterator(ltable->get_tree_c0(), ltable->getMergeData()->rbtree_mut, key);
c0_mergeable_it[0] = new typename memTreeComponent<TUPLE>::iterator (ltable->get_tree_c0_mergeable(), key);
disk_it[0] = ltable->get_tree_c1()->open_iterator(key);
disk_it[1] = ltable->get_tree_c1_mergeable()->open_iterator(key);
disk_it[2] = ltable->get_tree_c2()->open_iterator(key);
t = key;
} else {
c0_it = new typename memTreeComponent<TUPLE>::revalidatingIterator(ltable->get_tree_c0(), ltable->getMergeData()->rbtree_mut );
c0_mergeable_it[0] = new typename memTreeComponent<TUPLE>::iterator (ltable->get_tree_c0_mergeable() );
disk_it[0] = ltable->get_tree_c1()->open_iterator();
disk_it[1] = ltable->get_tree_c1_mergeable()->open_iterator();
disk_it[2] = ltable->get_tree_c2()->open_iterator();
t = NULL;
}
c0_it = new typename memTreeComponent<TUPLE>::revalidatingIterator(ltable->get_tree_c0(), ltable->getMergeData()->rbtree_mut, t);
c0_mergeable_it[0] = new typename memTreeComponent<TUPLE>::iterator (ltable->get_tree_c0_mergeable(), t);
disk_it[0] = ltable->get_tree_c1()->open_iterator(t);
if(ltable->get_tree_c1_mergeable()) {
disk_it[1] = ltable->get_tree_c1_mergeable()->open_iterator(t);
} else {
disk_it[1] = NULL;
}
disk_it[2] = ltable->get_tree_c2()->open_iterator(t);
inner_merge_it_t * inner_merge_it =
new inner_merge_it_t(c0_it, c0_mergeable_it, 1, NULL, TUPLE::compare_obj);
merge_it_ = new merge_it_t(inner_merge_it, disk_it, 3, NULL, TUPLE::compare_obj); // XXX Hardcodes comparator, and does not handle merges

View file

@ -42,7 +42,7 @@ void terminate (int param)
exit(0);
}
void initialize_server()
int main(int argc, char *argv[])
{
//signal handling
void (*prev_fn)(int);
@ -77,8 +77,14 @@ void initialize_server()
int lindex = mscheduler->addlogtable(&ltable);
ltable.setMergeData(mscheduler->getMergeData(lindex));
int64_t c0_size = 1024 * 1024 * 10;
printf("warning: running w/ tiny c0 for testing"); // XXX build a separate test server and deployment server?
int64_t c0_size = 1024 * 1024 * 1024 * 1;
if(argc == 2 && !strcmp(argv[0], "--test")) {
c0_size = 1024 * 1024 * 10;
printf("warning: running w/ tiny c0 for testing"); // XXX build a separate test server and deployment server?
}
mscheduler->startlogtable(lindex, c0_size);
unlock(ltable.header_lock);
@ -86,15 +92,6 @@ void initialize_server()
lserver = new logserver(10, 32432);
lserver->startserver(&ltable);
abort(); // can't get here.
}
/** @test
*/
int main()
{
initialize_server();
abort(); // can't get here.
}