method. It is a drop-in replacement for HWPREDICT, and is better suited for
data whose seasonal variations grow or shrink in proportion to the average.
-* Due to the new aggregation function, we also get a new version of the
- rrd file format.
+Incompatibility
+---------------
+* If you create an RRD with the new MHWPREDICT function, the resulting rrdfile will
+ be version 0004 and can only be used in rrdtool 1.3.
Locale Independent Input
------------------------
}
/* set some defaults */
- strcpy(rrd.stat_head->cookie, RRD_COOKIE);
- strcpy(rrd.stat_head->version, RRD_VERSION);
+ strcpy(rrd.stat_head->cookie, RRD_COOKIE);
+ strcpy(rrd.stat_head->version, RRD_VERSION3); /* by default we are still version 3 */
rrd.stat_head->float_cookie = FLOAT_COOKIE;
rrd.stat_head->ds_cnt = 0; /* this will be adjusted later */
rrd.stat_head->rra_cnt = 0; /* ditto */
rrd_set_error("Failed to parse CF name");
switch (cf_conv
(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
- case CF_HWPREDICT:
case CF_MHWPREDICT:
+ strcpy(rrd.stat_head->version, RRD_VERSION); /* MHWPREDICT causes Version 4 */
+ case CF_HWPREDICT:
/* initialize some parameters */
rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_alpha].
u_val = 0.1;
fputs("<!-- Round Robin Database Dump -->", out_file);
fputs("<rrd>", out_file);
- fprintf(out_file, "\t<version> %s </version>\n", RRD_VERSION);
+ if ( atoi(rrd.stat_head->version) <= 3) {
+ fprintf(out_file, "\t<version> %s </version>\n", RRD_VERSION3);
+ } else {
+ fprintf(out_file, "\t<version> %s </version>\n", RRD_VERSION);
+ }
fprintf(out_file, "\t<step> %lu </step> <!-- Seconds -->\n",
rrd.stat_head->pdp_step);
#if HAVE_STRFTIME
/* #define RRD_VERSION "0002" */
/* changed because microsecond precision requires another field */
#define RRD_VERSION "0004"
+#define RRD_VERSION3 "0003"
#define FLOAT_COOKIE 8.642135E130
#include "rrd_nan_inf.h"
rrd->stat_head = NULL;
return -1;
}
- /* make sure we output the right version */
- strcpy(rrd->stat_head->version, RRD_VERSION);
-
- /* if (atoi(rrd -> stat_head -> version) < 2)
- {
- rrd_set_error("Can only restore version >= 2 (Not %s). Dump your old rrd using a current rrdtool dump.", rrd -> stat_head -> version );
- return -1;
- } */
+ /* make sure we output the right version only go over 3 if input is over 3 too */
+ if (input_version > 3 ){
+ strcpy(rrd->stat_head->version, RRD_VERSION);
+ } else {
+ strcpy(rrd->stat_head->version, RRD_VERSION3);
+ }
rrd->stat_head->float_cookie = FLOAT_COOKIE;
rrd->stat_head->ds_cnt = 0;