From 975410845f3d9c9463adc9416253d7383810f056 Mon Sep 17 00:00:00 2001 From: sears Date: Tue, 11 Jan 2011 22:07:39 +0000 Subject: [PATCH] add empirically determined estimators of c0 size, and pessimistic ones that are the default git-svn-id: svn+ssh://svn.corp.yahoo.com/yahoo/yrl/labs/pnuts/code/logstore@1589 8dad8b1f-cf64-0410-95b6-bcf113ffbcfe --- mergeStats.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mergeStats.h b/mergeStats.h index 12e6629..d35b7ed 100644 --- a/mergeStats.h +++ b/mergeStats.h @@ -38,6 +38,15 @@ class mergeStats { mergeManager::double_to_ts(&stats_last_tick, mergeManager::tv_to_double(&last)); #endif } + pageid_t rb_size_estimator(pageid_t num_bytes, pageid_t num_tuples) { + // Experimentally determined numbers +// pageid_t small_tup_est = num_bytes + 110L * num_tuples; +// pageid_t big_tup_est = num_bytes + (2L * num_bytes) / 100L; + // Pessimistic numbers + pageid_t small_tup_est = num_bytes + 220L * num_tuples; + pageid_t big_tup_est = num_bytes + (4L * num_bytes) / 100L; + return big_tup_est > small_tup_est ? big_tup_est : small_tup_est; // max + } public: mergeStats(int merge_level, int64_t target_size) : merge_level(merge_level), @@ -149,8 +158,8 @@ class mergeStats { } pageid_t get_current_size() { if(merge_level == 0) { - printf("base = %lld in_s = %lld in_l = %lld out = %lld\n", base_size, bytes_in_small, bytes_in_large, bytes_out); - return base_size + bytes_in_small - bytes_in_large - bytes_out; + return rb_size_estimator(base_size + bytes_in_small - bytes_in_large - bytes_out, + /*num_tuples_base + */ num_tuples_in_small - num_tuples_in_large - num_tuples_out);; } else { // s->bytes_out has strange semantics. It's how many bytes our input has written into this tree. return base_size + bytes_out - bytes_in_large;