summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 10494c6)
raw | patch | inline | side by side (parent: 10494c6)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 22 Jul 2007 09:47:53 +0000 (09:47 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sun, 22 Jul 2007 09:47:53 +0000 (09:47 +0000) |
diff --git a/program/NEWS b/program/NEWS
index 542783b817c4c57019adf1e379fe8cb1d9588dac..6054e3593f08853674b7ee5b912362d551d70dd7 100644 (file)
--- a/program/NEWS
+++ b/program/NEWS
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
------------------------
index 0e2f82c14150e8d39ef28cd0f42dbed1192cdaf2..4e442d2a932b95d52c63cb493c7f0b3b215c5f36 100644 (file)
--- a/program/src/rrd_create.c
+++ b/program/src/rrd_create.c
}
/* 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;
diff --git a/program/src/rrd_dump.c b/program/src/rrd_dump.c
index eb9b4690e0fbb22f1788b95711695a80a8fa3499..be000f9cdd8344db4172a807ecf861048f3b92ab 100644 (file)
--- a/program/src/rrd_dump.c
+++ b/program/src/rrd_dump.c
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
index 7dbc8edb313f91c72bd53e33a1b91a592daf9ff0..d95ea4a73a31178519e689a8829c88e12c0ade4d 100644 (file)
--- a/program/src/rrd_format.h
+++ b/program/src/rrd_format.h
/* #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"
index 65bbb10438b0d9a7e0e72d0fbcaaa438e20fb46d..1164adbec0c9df876470030023a3b62c321f8146 100644 (file)
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;