[rrd-developers] [rrd-users] invalid data / spikes FIXED
Tobias Oetiker
oetiker at ee.ethz.ch
Fri Jan 7 08:35:53 MET 2000
Wednesday you sent me mail regarding [rrd-users] Re: followup on invalid...:
*> I have been able to shorten it considerably.
*> Here is the new sequence (using csh, or tcsh):
*>
*>
*> mon1:~ rrdtool create my.rrd -b 946843500 -s 300 "DS:load:GAUGE:300:0:5000" "DS:out_oct:COUNTER:300:0:1250000" "DS:drop_oct:COUNTER:300:0:U"
*> "DS:out_pkts:COUNTER:300:0:25000" "DS:drop_pkts:COUNTER:300:0:U" "RRA:AVERAGE:0.5:1:864" "RRA:AVERAGE:0.5:3:1344" "RRA:AVERAGE:0.5:12:744"
*> "RRA:AVERAGE:0.5:288:91"
*> mon1:~ rrdtool update my.rrd 947097000:0.00:107015782:0:156363:0
*> mon1:~ rrdtool dump my.rrd > db.out
*> mon1:~ rrdtool restore db.out my.rrd
*> mon1:~ rrdtool update my.rrd 947097300:0.01:107015782:0:156363:0
*> mon1:~ rrdtool dump my.rrd > db.out
*> mon1:~ rrdtool restore -r db.out db.xml
*> out of range found [ds: 3], [value : 1.9991590274e+37]
*>
Folks! Thanks to Bill Fenner <fenner at research.att.com> the mistery is solved
... rrd_update is in violation of the ANSY C standard (7.9.5.3) by issuing an
fwrite immediately after fread some times ... here is the patch ...
-------------------------------------------------------------------------------
--- rrd_update.old Sat Dec 25 21:10:02 1999
+++ rrd_update.c Fri Jan 7 07:36:30 2000
@@ -109,7 +109,18 @@
return -1;
}
rra_current = rra_start = rra_begin = ftell(rrd_file);
+ /* This is defined in the ANSI C standard, section 7.9.5.3:
+ When a file is opened with udpate mode ('+' as the second
+ or third character in the ... list of mode argument
+ variables), both input and ouptut may be performed on the
+ associated stream. However, ... input may not be directly
+ followed by output without an intervening call to a file
+ positioning function, unless the input oepration encounters
+ end-of-file. */
+ fseek(rrd_file, 0, SEEK_CUR);
+
+
/* get exclusive lock to whole file.
* lock gets removed when we close the file.
*/
-------------------------------------------------------------------------------
it seems that the most Unix C libraries do not care for this, and work all
the same ... thats why it was so difficult to catch this ...
cheers
tobi
--
______ __ _
/_ __/_ / / (_) Oetiker, Timelord & SysMgr @ EE-Dept ETH-Zurich
/ // _ \/ _ \/ / TEL: +41(0)1-6325286 FAX:...1517 ICQ: 10419518
/_/ \.__/_.__/_/ oetiker at ee.ethz.ch http://ee-staff.ethz.ch/~oetiker
--
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
More information about the rrd-developers
mailing list