diff --git a/diskTreeComponent.h b/diskTreeComponent.h index 3f627c5..d9f0aa9 100644 --- a/diskTreeComponent.h +++ b/diskTreeComponent.h @@ -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); diff --git a/logstore.h b/logstore.h index 674fa72..b9fa07a 100644 --- a/logstore.h +++ b/logstore.h @@ -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::iterator *c0_mergeable_it[1]; diskTreeComponent::iterator * disk_it[3]; epoch = ltable->get_epoch(); + + datatuple *t; if(last_returned) { - c0_it = new typename memTreeComponent::revalidatingIterator(ltable->get_tree_c0(), ltable->getMergeData()->rbtree_mut, last_returned); - c0_mergeable_it[0] = new typename memTreeComponent::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::revalidatingIterator(ltable->get_tree_c0(), ltable->getMergeData()->rbtree_mut, key); - c0_mergeable_it[0] = new typename memTreeComponent::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::revalidatingIterator(ltable->get_tree_c0(), ltable->getMergeData()->rbtree_mut ); - c0_mergeable_it[0] = new typename memTreeComponent::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::revalidatingIterator(ltable->get_tree_c0(), ltable->getMergeData()->rbtree_mut, t); + c0_mergeable_it[0] = new typename memTreeComponent::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 diff --git a/server.cpp b/server.cpp index 6ac2d59..b8e06d2 100644 --- a/server.cpp +++ b/server.cpp @@ -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(<able); 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(<able); + + abort(); // can't get here. } - - - -/** @test - */ -int main() -{ - initialize_server(); - abort(); // can't get here. -} -