From 48b7b284e76ed01af3bc0b87dd15fb860c017464 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sat, 25 Feb 2012 16:09:41 +0000 Subject: [PATCH] for RRAs with a step count of 1, treat MIN/MAX/LAST and AVERAGE as equal, so there is no need to create a MIN/MAX/LAST entry for the highest resolution. -- Martin Sperl git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@2279 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_fetch.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/rrd_fetch.c b/src/rrd_fetch.c index bbb5314..47b4166 100644 --- a/src/rrd_fetch.c +++ b/src/rrd_fetch.c @@ -270,7 +270,34 @@ int rrd_fetch_fn( /* find the rra which best matches the requirements */ for (i = 0; (unsigned) i < rrd.stat_head->rra_cnt; i++) { - if (cf_conv(rrd.rra_def[i].cf_nam) == cf_idx) { + enum cf_en rratype=cf_conv(rrd.rra_def[i].cf_nam); + /* handle this RRA */ + if ( + /* if we found a direct match */ + (rratype == cf_idx) + || + /*if we found a DS with interval 1 + and CF (requested,available) are MIN,MAX,AVERAGE,LAST + */ + ( + /* only if we are on interval 1 */ + (rrd.rra_def[i].pdp_cnt==1) + && ( + /* and requested CF is MIN,MAX,AVERAGE,LAST */ + (cf_idx == CF_MINIMUM) + ||(cf_idx == CF_MAXIMUM) + ||(cf_idx == CF_AVERAGE) + ||(cf_idx == CF_LAST) + ) + && ( + /* and found CF is MIN,MAX,AVERAGE,LAST */ + (rratype == CF_MINIMUM) + ||(rratype == CF_MAXIMUM) + ||(rratype == CF_AVERAGE) + ||(rratype == CF_LAST) + ) + ) + ){ cal_end = (rrd.live_head->last_up - (rrd.live_head->last_up % (rrd.rra_def[i].pdp_cnt -- 2.11.0