[rrd-developers] FOUND IT! (was: rrd_graph.c: draw_horizontal_grid()...)

Stanislav Sinyagin ssinyagin at yahoo.com
Mon Apr 28 19:41:15 MEST 2003

Finally I found it. 

This all happened because of the inconsistency between rrd_open.c 
and rrd_create.c.

As far as I understand (CVSWeb would be nice...), that's because of 
the latest Jake's changes. 

rrd_open.c reads live_head differently, depending on version:

    if(version < 3) {
            rrd->live_head = (live_head_t *)malloc(sizeof(live_head_t));
            if(rrd->live_head == NULL) {
                rrd_set_error("live_head_t malloc");
                return (-1);
                fread(&rrd->live_head->last_up, sizeof(long), 1, *in_file); 
                rrd->live_head->last_up_usec = 0;
    else {
            MYFREAD(rrd->live_head, live_head_t, 1)

But rrd_create.c has no idea about the RRD version being created:

           sizeof(live_head_t),1, rrd_file);

As a result, the simple command
  ./bin/rrdtool create /tmp/a.rrd DS:A:GAUGE:300:U:U RRA:AVERAGE:0.5:1:100 

creates Version 1 file with fullsize live_head in it. 
Then rrd_open reads in the data with some offset caused by this conflict.
Then we get the last row filled in with some arbitrary data:

./bin/rrdtool dump /tmp/a.rrd
<!-- 2003-04-28 19:00:00 MEST / 1051549200 --> <row><v> 
NaN </v></row>
                        <!-- 2003-04-28 19:05:00 MEST / 1051549500 --> <row><v> 
2.1113858120e-312 </v></row>

In addition, rrd_dump always prints version=3, regardless of the file version:
    printf("\t<version> %s </version>\n",RRD_VERSION);

As far as I understand, this is not fully correct. 


Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the rrd-developers mailing list