[rrd-users] rrd resize error
Daniel De Marco
ddm at bartol.udel.edu
Tue Jun 28 05:09:37 CEST 2011
Hi Tobi,
* Tobias Oetiker <tobi at oetiker.ch> [06/27/2011 18:33]:
> only in the sense that I was not able to reproduce this on our
> systems ... it would be great to figure the cause of this ...
I looked into it a little bit and I think I found something.
In the text below I'm referring to line numbers as in 1.4.5.
On my system creating a file with:
./rrdtool create pippo.rrd DS:test:GAUGE:120:0:U RRA:AVERAGE:0.5:1:2
creates it with a header size of 548, that is not divisible by sizeof(rrd_value_t)=8.
I don't know whether this is normal or not. However this seems connected with
the code in rrd_resize.c around line 264:
/* Move the rest of the CDPs
*/
while (1) {
if (rrd_read(rrd_file, &buffer, sizeof(rrd_value_t) * 1) <= 0)
break;
rrd_write(rrd_out_file, &buffer, sizeof(rrd_value_t) * 1);
}
Since the header size is not multiple of sizeof(rrd_value_t) the last
rrd_read in the above block reads just half of a sizeof(rrd_value_t) in
my case and when the write goes to write it out it tries to write past
the end of file triggering the error.
For this block the fix is trivial, but I suspect the problem is in the
header. I tried on a few machines and the header size oddity seems to
happen only on i386. On x86_64 the header size is always a multiple of
sizeof(rrd_value_t). For my example file the header size on x86_64 is
592.
I hope this helps.
Thanks for the great tool, Daniel.
More information about the rrd-users
mailing list