rrdtool.git
15 years agoadd rrdcached examples -- kevin
oetiker [Wed, 3 Dec 2008 08:47:56 +0000 (08:47 +0000)]
add rrdcached examples -- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1685 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agofixed solaris build instructions
oetiker [Tue, 2 Dec 2008 12:35:02 +0000 (12:35 +0000)]
fixed solaris build instructions

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1683 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoadded libdbi doc to extradist
oetiker [Mon, 1 Dec 2008 11:05:52 +0000 (11:05 +0000)]
added libdbi doc to extradist

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1682 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoAttached a patch for the rrd-tool LIBDBI integration with the following improvements:
oetiker [Thu, 20 Nov 2008 13:04:38 +0000 (13:04 +0000)]
Attached a patch for the rrd-tool LIBDBI integration with the following improvements:

a) correct error handling in case of libdbi being unable to load the driver
   was producing segmentation faults.

b) better parsing of datasources

   * until now timestamp fields had to be integer and had to contain a unix
     timestamp - now you can now also use DateTime fields (you still need to
     specify it, as the time-range needs to be defined correctly)

   * data fields are now no longer limited to (var)char or DOUBLE fields -
     FLOAT, INTEGER,... are now also supported.

c) there is a bug with at least LIBDBI 0.8.1 in conjunction with mysql that
   can result in segmentation faults when BINARY/BLOB fields are accessed -
   rrdtool will now tell you about this fact before dying ;)

d) also the value of rrdderivemaxstep only gets applied if derive has been
   selected correctly.

e) "GROUP BY timestamp" has been removed from SQL statement.

f) "ORDER BY timestamp" will be added only in the case of fetching "derived" data.

-- Martin Sperl

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1678 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agowin32 portability patch and win32/rrdlib.vcproj file for the source
oetiker [Tue, 18 Nov 2008 17:19:17 +0000 (17:19 +0000)]
win32 portability patch and win32/rrdlib.vcproj file for the source
-- christof wegmann Christof.Wegmann with exitgames.com
some fixes to make the result work on unix again ...

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1677 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agomissing , added to help string
oetiker [Tue, 18 Nov 2008 07:14:10 +0000 (07:14 +0000)]
missing , added to  help string

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1674 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoadded build instruction for libdbi docu
oetiker [Mon, 17 Nov 2008 16:21:41 +0000 (16:21 +0000)]
added build instruction for libdbi docu

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1672 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agomissing pod files
oetiker [Sun, 16 Nov 2008 22:24:44 +0000 (22:24 +0000)]
missing pod files

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1670 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoswitch tu using AS_HELP_STRING for formatting ...
oetiker [Sat, 15 Nov 2008 14:35:51 +0000 (14:35 +0000)]
switch tu using AS_HELP_STRING for formatting ...

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1669 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agofix typo in handle_request_help
oetiker [Sat, 15 Nov 2008 14:15:38 +0000 (14:15 +0000)]
fix typo in handle_request_help
--kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1668 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agodoc fixups for rrdcacehd
oetiker [Sat, 15 Nov 2008 14:14:19 +0000 (14:14 +0000)]
doc fixups for rrdcacehd

 * documented the -p option
 * added nbsp between option and argument
 * layout one option per line

--kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1667 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agomake basename work
oetiker [Tue, 11 Nov 2008 16:36:45 +0000 (16:36 +0000)]
make basename work

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1666 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis patch allows for multiple RRD writer threads to service the queue.
oetiker [Tue, 11 Nov 2008 16:36:13 +0000 (16:36 +0000)]
This patch allows for multiple RRD writer threads to service the queue.

Now, rrdcached can have more simultaneous I/O requests into the kernel.
This may allow the kernel to re-order disk writes, resulting in better
disk throughput.  In practice, throughput is increased by 2-3x.

The flush (-f) timer maintenance has been moved from queue_thread_main
into its own thread.

Be more careful about when to use pthread_cond_signal vs _broadcast, since
multiple threads may be waiting on &queue_cond.

--kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1665 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agobe even more liberal with NOT using isfinite on solaris2.8
oetiker [Sun, 9 Nov 2008 19:19:48 +0000 (19:19 +0000)]
be even more liberal with NOT using isfinite on solaris2.8

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1663 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agouse basename to determine filename for imginfo as suggested by sebastian
oetiker [Sun, 9 Nov 2008 00:00:33 +0000 (00:00 +0000)]
use basename to determine filename for imginfo as suggested by sebastian

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1662 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years ago rrdcached: move queue length decrement into remove_from_queue
oetiker [Sat, 8 Nov 2008 22:57:38 +0000 (22:57 +0000)]
 rrdcached: move queue length decrement into remove_from_queue
-- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1661 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agorrdcached: examine the current queue with the "QUEUE" command
oetiker [Sat, 8 Nov 2008 22:57:18 +0000 (22:57 +0000)]
rrdcached: examine the current queue with the "QUEUE" command
-- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1660 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis helps with portability on platforms where realloc doesn't handle NULL.
oetiker [Sat, 8 Nov 2008 22:50:51 +0000 (22:50 +0000)]
This helps with portability on platforms where realloc doesn't handle NULL.
-- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1659 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agodocument the "QUIT" command -- kevin
oetiker [Sat, 8 Nov 2008 18:01:33 +0000 (18:01 +0000)]
document the "QUIT" command -- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1658 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agorrdcached: journal_replay default failure reason, just in case
oetiker [Sat, 8 Nov 2008 18:01:01 +0000 (18:01 +0000)]
rrdcached: journal_replay default failure reason, just in case
avoids a "may be used uninitialized" warning -- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1657 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoadded "quit" command -- kevin
oetiker [Sat, 8 Nov 2008 18:00:21 +0000 (18:00 +0000)]
added "quit" command -- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1656 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agorrdcached now frees all of its resources correctly. This facilitates
oetiker [Sat, 8 Nov 2008 17:57:32 +0000 (17:57 +0000)]
rrdcached now frees all of its resources correctly.  This facilitates
memory debugging.  g_tree now knows how to free the nodes when it removes
them.

Also, use g_tree_replace instead of g_tree_insert.  This fixes a bug
triggered when the same file was simultaneously inserted by two clients.

--kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1655 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agodo not quit when libdbi is missing
oetiker [Sat, 8 Nov 2008 17:56:48 +0000 (17:56 +0000)]
do not quit when libdbi is missing

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1654 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agofixed --font TITLE:12: problem -- tobi
oetiker [Fri, 7 Nov 2008 22:46:40 +0000 (22:46 +0000)]
fixed --font TITLE:12: problem -- tobi

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1653 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agofix scaling issue -- Martin
oetiker [Fri, 7 Nov 2008 22:23:16 +0000 (22:23 +0000)]
fix scaling issue -- Martin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1652 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoextra file to make libdbi patch work
oetiker [Fri, 7 Nov 2008 14:09:29 +0000 (14:09 +0000)]
extra file to make libdbi patch work

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1651 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoAs some of you may know that I have created a patch for rrdtool 1.2 a few years...
oetiker [Fri, 7 Nov 2008 14:07:53 +0000 (14:07 +0000)]
As some of you may know that I have created  a patch for rrdtool 1.2 a few years ago, so that a database could be queried  for
values for graphing.

The patch has been mostly rewritten and the following changes have been made:

   * high dependency on mysql has been reduced by avoiding the
     temporary tables (which was bad for mysql replication)
   * The number of executed SQL-Statements for one CDEF has been
     reduced to 1 compared to 11 SQLs (including CREATE TEMPORARY
     TABLE) - for patch against version 1.2
   * All consolidation is done in rrdtool itself (MIN,MAX,AVERAGE)
   * Additional consolidation functions are COUNT and SIGMA, which give
     information on statistics on a per "time-bin" basis.
   * All these consolidation values are always returned as separate
     columns, that are returned by RRD and the consolidation function
     given as Argument is ignored.
     Main reason is that this way there is only one call to rrd_fetcht
     and thus the database even if we need to fetch for example min,
     avg and max. Compare this to 3 calls in case of different
     consolidation functions - and if you want to get SIGMA and COUNT
     as well it is still only one call to the backend and the database.
   * Some previous existing features have been taken out at the moment
     to allow for this reduced set of SQL queries.
         o prediction using the values from the last X days at the same
           time
         o the corresponding sigma calculation
   * The idea is to create generic CDEF's that will do the same thing,
     but that is also available when using RRD-files (similar to TREND,
     but with another scope)
     This will get posted as a separate patch.
   * Overall performance should be much better and the patch as a whole
     simpler.
   * The patch also includes modifications to the configuration
     infrastructure, to make libdbi support optional.

-- Martin Sperl

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1650 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agonew CDEF functions for predictions PREDICT and PREDICTSIGMA
oetiker [Fri, 7 Nov 2008 14:02:09 +0000 (14:02 +0000)]
new CDEF functions for predictions PREDICT and PREDICTSIGMA
-- Martin Sperl

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1649 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoMuch simpler handling of timestamp errors. Return an error to the user
oetiker [Fri, 7 Nov 2008 13:51:24 +0000 (13:51 +0000)]
Much simpler handling of timestamp errors.  Return an error to the user
when any of the time stamp values are invalid.  This is similar to
RRDTool's normal behavior.  Removed the complex logic previously used to
return error codes to the user.

This solves a bug where non-advancing timestamps could have produced
incorrect error output during "BATCH" mode.  The bug was cause by using
the sock->wbuf pointer for the error output. -- kevin brintnall

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1648 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agorrdcached: pull in rrd_config.h so we can use its defines
oetiker [Fri, 7 Nov 2008 13:45:34 +0000 (13:45 +0000)]
rrdcached: pull in rrd_config.h so we can use its defines
... particularly HAVE_VSNPRINTF --  kevin brintnall

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1647 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoI realize now that the problem is the line
oetiker [Tue, 4 Nov 2008 07:12:46 +0000 (07:12 +0000)]
I realize now that the problem is the line

    test -f lua/Makefile && cd lua && $(MAKE) install || true

in the target "install-data-local", in bindings/Makefile.am. It forces
execution of bindings/lua/Makefile independently of lua being found or
not. I added that line in my first patch, following perl, python and
ruby build style, but it's not needed after I switched to automake. The
make recursion is controlled by SUBDIRS, which will only contain "lua"
if BUILD_LUA is true.

-- Fidelis Assis

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1645 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agofix build process for systems without lua
oetiker [Sun, 2 Nov 2008 17:25:36 +0000 (17:25 +0000)]
fix build process for systems without lua

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1644 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoPTHREAD_COND_INITIALIZER may only be used to initialize static cond variables.
oetiker [Sun, 2 Nov 2008 17:09:36 +0000 (17:09 +0000)]
PTHREAD_COND_INITIALIZER may only be used to initialize static cond variables.
-- Sebastian Harl

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1643 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoreverting non build makefile patch ... we need to lua makefile for building the ditri...
oetiker [Sun, 2 Nov 2008 15:25:48 +0000 (15:25 +0000)]
reverting non build makefile patch ... we need to lua makefile for building the ditribution

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1642 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agodo not create the lua makefile if lua is not to be compiled.
oetiker [Sat, 1 Nov 2008 09:09:07 +0000 (09:09 +0000)]
do not create the lua makefile if lua is not to be compiled.

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1641 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agofix from alex
oetiker [Thu, 30 Oct 2008 14:32:09 +0000 (14:32 +0000)]
fix from alex

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1638 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years ago- remove the spaccing between the elements
oetiker [Tue, 28 Oct 2008 08:57:13 +0000 (08:57 +0000)]
- remove the spaccing between the elements
- add xsd support to dump output
- change the argument "[--no-header|-n]" to [--header|-h {xsd,dtd}]
-- tobias.lindenmann 1und1.de

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1637 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agomake compilation on older OSX versios work by removing the # from the librrd.sym...
oetiker [Sun, 26 Oct 2008 15:18:33 +0000 (15:18 +0000)]
make compilation on older OSX versios work by removing the # from the librrd.sym file

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1632 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agofixed typo ... GAUGE not GUAGE
oetiker [Fri, 24 Oct 2008 06:20:21 +0000 (06:20 +0000)]
fixed typo ... GAUGE not GUAGE

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1628 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThe previous code relied on the assumption that pthread_cond_init(&cond)
oetiker [Wed, 22 Oct 2008 20:41:59 +0000 (20:41 +0000)]
The previous code relied on the assumption that pthread_cond_init(&cond)
was equivalent to memset(&cond,0).  This may not be true on all platforms.
-- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1627 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoremove_cache_item() did not check whether a file was in queue before
oetiker [Wed, 22 Oct 2008 06:02:23 +0000 (06:02 +0000)]
remove_cache_item() did not check whether a file was in queue before
modifying the cache head/tail pointers.  Therefore, the process of
flushing old files may perturb the cache_queue_head pointer.  This caused
some nodes with CI_FLAGS_IN_QUEUE to be un-linked from the queue list.

Thereafter, they would not be flushed by any periodic process (although
they could be revived with FLUSH or UPDATE).  This caused a slow memory
leak for files that are no longer updated.  Pending updates for these
"abandoned" files would remain in memory ad infinitum.

With this patch, remove_from_queue() will check that the item is queued
before modifying the head/tail pointers.  This restores the intended
behavior.
--kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1626 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agothis was replaced by Makefile.am
oetiker [Wed, 22 Oct 2008 05:08:47 +0000 (05:08 +0000)]
this was replaced by Makefile.am

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1625 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoguess one needs that in svn too for luabindings to work
oetiker [Tue, 21 Oct 2008 06:10:32 +0000 (06:10 +0000)]
guess one needs that in svn too for luabindings to work

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1624 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years ago * Open all listen sockets in daemonize(), while we still have stderr.
oetiker [Tue, 21 Oct 2008 05:42:50 +0000 (05:42 +0000)]
 * Open all listen sockets in daemonize(), while we still have stderr.
   Changed open_listen_socket_* routines to complain to stderr.  Now, any
   errors in binding to the listen sockets are much more obvious.

 * Simplified exit of parent after fork()

 * PID file will be correctly cleaned up if there is a failure in daemonize().

 * unlink the unix socket before trying to bind()
   (after we're sure we have the PID file)

-- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1623 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agorrd_notify_row patch:
oetiker [Mon, 20 Oct 2008 11:46:08 +0000 (11:46 +0000)]
rrd_notify_row patch:

 - Delegate choice of starting row for newly created RRD  files to the  rrd_open.c API.
 - Introduce the rrd_notify_row() function so that an implementation can choose to align the rows of new RRDs with existing  RRDs, if desirable.
 - Maintain the existing behaviour (random starting row) by default.

-- Daniel.Pocock

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1622 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years ago- Lua module build and install process rewritten using automake+libtool
oetiker [Mon, 20 Oct 2008 06:06:16 +0000 (06:06 +0000)]
- Lua module build and install process rewritten using automake+libtool
- improved check for compat-5.1 availability
-- Fidelis Assis

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1621 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agorrd_open should not create files with restrictive masks
oetiker [Sat, 18 Oct 2008 22:32:19 +0000 (22:32 +0000)]
rrd_open should not create files with restrictive masks

Removed unnecessary "mode" varaible.  The mode is only used when O_CREAT is
specified, where we want to use 0666 (as rrd_create_fn did r<=1612).
--kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1620 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years ago- encapsulate fd and mmap related variables within a private data
oetiker [Sat, 18 Oct 2008 15:50:07 +0000 (15:50 +0000)]
- encapsulate fd and mmap related variables within a private data
structure
- rrd_file_t keeps a pointer to the private data structure of type
void*, so that other block storage implementations can store their
internal data with rrd_file_t
-- Daniel.Pocock

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1619 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agorrdc_flush_if_daemon should not clobber error message -- kevin (as suggested by Sebas...
oetiker [Fri, 17 Oct 2008 05:50:22 +0000 (05:50 +0000)]
rrdc_flush_if_daemon should not clobber error message -- kevin (as suggested by Sebastian)

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1618 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agouse double for legend positioning to fight wiggle
oetiker [Fri, 17 Oct 2008 05:44:09 +0000 (05:44 +0000)]
use double for legend positioning to fight wiggle

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1617 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agofix version numbers in compile instructions
oetiker [Thu, 16 Oct 2008 21:33:08 +0000 (21:33 +0000)]
fix version numbers in compile instructions
tobi

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1616 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoIn almost all cases where rrdc_flush can fail, it will leave a more
oetiker [Thu, 16 Oct 2008 21:30:17 +0000 (21:30 +0000)]
In almost all cases where rrdc_flush can fail, it will leave a more
descriptive error message anyway..  better not overwrite it.
-- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1614 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years ago- rrd_open() calculates file size for new files and calls mmap once for
oetiker [Thu, 16 Oct 2008 21:12:27 +0000 (21:12 +0000)]
- rrd_open() calculates file size for new files and calls mmap once for
the whole file

- rrd_resize() cleaned up, no longer passing a size through the cookie
argument

- rrd_init(&my_rrd) must be called before rrd_open() - if people are
calling rrd_open directly from application code, this might be
troublesome.  Alternative solutions: creating an additional function,
rrd_open_create(), or adding an extra argument to rrd_open() for setting
the file size

-- Daniel Pocock

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1613 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agomove rrd_lock into rrd_open where the general rrd_file ops are located. -- Daniel...
oetiker [Thu, 16 Oct 2008 21:05:51 +0000 (21:05 +0000)]
move rrd_lock into rrd_open where the general rrd_file ops are located. -- Daniel Pocock

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1612 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoerror reporting caused crash in journal replay
oetiker [Thu, 16 Oct 2008 06:11:54 +0000 (06:11 +0000)]
error reporting caused crash in journal replay

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1610 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agobetter build docs
oetiker [Thu, 16 Oct 2008 06:11:44 +0000 (06:11 +0000)]
better build docs

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1609 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoreverted r1601 and r1606 since r1601 introduced a non portable mremap and r1606 has...
oetiker [Wed, 15 Oct 2008 05:29:41 +0000 (05:29 +0000)]
reverted r1601 and r1606 since r1601 introduced a non portable mremap and r1606 has a dependency on r1601.

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1607 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis moves selection of the initial RRA row into the rrd_open.c API
oetiker [Tue, 14 Oct 2008 20:14:35 +0000 (20:14 +0000)]
This moves selection of the initial RRA row into the rrd_open.c API

The current implementation (random row) is used by default.  However, it
now provides an opportunity for alternative implementations to integrate
with rrdtool in a single place.

Maybe there are other places in rrdtool where I should insert calls to
the function rrd_notify_row()?

This has been tested with rrdtool create and rrdtool info to verify that
random rows are selected by default (existing behaviour preserved).

-- Daniel Pocock

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1606 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoUnder most circumstances, rrdcached can detect a stale pid file.
oetiker [Tue, 14 Oct 2008 19:23:24 +0000 (19:23 +0000)]
Under most circumstances, rrdcached can detect a stale pid file.

If the process in the pid file does not exist, or cannot be signalled by
the rrdcached owner, then rrdcached will replace the pid file and start
normally.  Otherwise, it will complain verbosely to STDERR.

--kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1605 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years ago * this preserves principle of least surprise when dealing with files that
oetiker [Tue, 14 Oct 2008 19:08:56 +0000 (19:08 +0000)]
 * this preserves principle of least surprise when dealing with files that
   are reachable via many path strings.  i.e. when $PWD=/base/dir the
   following files are the same:

        /base/dir/x.rrd
        x.rrd
        ../dir/x.rrd

 * for performance, absolute paths (starting with '/') are not resolved.
   this reduces the number of stat(2) system calls.

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1604 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoNow, the daemon will check that a base directory is NOT reached via
oetiker [Tue, 14 Oct 2008 19:08:36 +0000 (19:08 +0000)]
Now, the daemon will check that a base directory is NOT reached via
symbolic link.  Documentation added to illustrate the restriction.

This allows several simplifying (and performance-enhancing) assumptions to
be made elsewhere in the code:

 * it ensures that paths resolved in the client via realpath() will match
   our data structure keys

 * it's possible to generate the correct absolute path when given a
   relative path by simply prepending the base directory

 * it's not necessary to resolve paths that begin with '/'
 -- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1603 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agorrdcached treats relative and absolute paths the same -- kevin
oetiker [Tue, 14 Oct 2008 19:08:00 +0000 (19:08 +0000)]
rrdcached treats relative and absolute paths the same -- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1602 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoSome observations I made while implementing this:
oetiker [Tue, 14 Oct 2008 11:33:37 +0000 (11:33 +0000)]
Some observations I made while implementing this:

- In rrd_open(), the call to rrd_init() clobbers values already populated in
rrd_create.c

- The logic for newfile_size in rrd_open() wasn't really able to cope with the
logic for a file starting with size 0

I've tried to deal with these issues, but maybe there is a more elegant solution.

-- Daniel Pocock

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1601 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoclearer way of advancing the flush time
oetiker [Tue, 14 Oct 2008 06:37:19 +0000 (06:37 +0000)]
clearer way of advancing the flush time
-- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1600 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis patch reduces the number of time()/gettimeofday() system calls when
oetiker [Mon, 13 Oct 2008 22:07:14 +0000 (22:07 +0000)]
This patch reduces the number of time()/gettimeofday() system calls when
doing high volume processing.  This enables about 25% speed increase
during journal replay and "BATCH" processing.  (this is a function of
syscall overhead).

 * note when "BATCH" processing or journal replay starts, use that
   timestamp for all commands

 * use the batch start time to detect when we're in batch mode.  no longer
   need a separate boolean.

 * pass the time_t into handle_request

 * pass the time_t through to the commands that need it

-- kevin brintnall

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1599 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agofixed bad folding marker (on handle_request_flush)
oetiker [Mon, 13 Oct 2008 18:41:12 +0000 (18:41 +0000)]
fixed bad folding marker (on handle_request_flush)
-- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1598 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agothis ensures that the response is protocol-compliant even if additional
oetiker [Sat, 11 Oct 2008 09:53:40 +0000 (09:53 +0000)]
this ensures that the response is protocol-compliant even if additional
info has been added to the write buffer during processing.
-- kevin brintnall

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1597 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis patch introduces a feature whereby rrdcached will disallow updates
oetiker [Sat, 11 Oct 2008 09:37:53 +0000 (09:37 +0000)]
This patch introduces a feature whereby rrdcached will disallow updates
that do not advance the update time.  This prevents the updates from being
discarded later by rrd_update_r.

This patch attempts to make the most of the protocol's limited ability to
return error text when using a -1 return code.

-- kevin brintnall

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1596 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis patch ensures that when rrdcached is stopped, it cleans up the
oetiker [Fri, 10 Oct 2008 05:21:19 +0000 (05:21 +0000)]
This patch ensures that when rrdcached is stopped, it cleans up the
pid file.  Apparently this is necessary if RRDCACHED_USER is not the
default "rrdcached".
-- Bernard Li

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1595 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThe patch I submitted for rrdtool.spec introduced a bug where there
oetiker [Fri, 10 Oct 2008 05:21:01 +0000 (05:21 +0000)]
The patch I submitted for rrdtool.spec introduced a bug where there
are two ldconfig calls in the %postun section.  This patch fixes that.
--  Bernard Li

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1594 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis patch does two things:
oetiker [Fri, 10 Oct 2008 05:19:06 +0000 (05:19 +0000)]
This patch does two things:

- remove the --pidfile check, for compatibility with older RHEL/Centos
  systems

- update the username used by the init script, to remain consistent with
  Bernard's changes to the spec file

-- Daniel.Pocock

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1593 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoSplit-out rrd-cached subpackage -- Bernard Li
oetiker [Wed, 8 Oct 2008 20:47:04 +0000 (20:47 +0000)]
Split-out rrd-cached subpackage -- Bernard Li

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1592 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis patch updates the spec file and includes the librrd.pc file in
oetiker [Wed, 8 Oct 2008 05:49:24 +0000 (05:49 +0000)]
This patch updates the spec file and includes the librrd.pc file in
the -devel subpackage so that you can build the RPM again.
-- Bernard

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1591 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agofix crash reported by Bernard Li - connection_thread_main: avoid double calls to...
oetiker [Wed, 8 Oct 2008 05:47:39 +0000 (05:47 +0000)]
fix crash reported by Bernard Li - connection_thread_main: avoid double calls to close_connection -- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1590 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agofixed typo
oetiker [Wed, 8 Oct 2008 05:46:21 +0000 (05:46 +0000)]
fixed typo

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1589 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis patch introduces two new commands for cache management:
oetiker [Tue, 7 Oct 2008 21:10:54 +0000 (21:10 +0000)]
This patch introduces two new commands for cache management:

 PENDING: shows any un-written updates for a file
 FORGET : remove a file completely from cache

-- kevin brintnall

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1588 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis patch moves the permission handling code around a bit.
oetiker [Tue, 7 Oct 2008 21:08:30 +0000 (21:08 +0000)]
This patch moves the permission handling code around a bit.

 * moved privilege checks into the command handler functions
   (possible now that we pass the sock data structures around)

 * on UPDATE, delay journal_write until after check_file_access().
   previously, it was possible for a high-priv socket to introduce
   commands into the journal that could be replayed if they were
   still in the journal at next startup.

 * moved has_privilege() further up in the file to avoid need
   for prototype.

--  kevin brintnall

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1587 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis patch introduces some extra safety checks in journal processing,
oetiker [Tue, 7 Oct 2008 16:28:24 +0000 (16:28 +0000)]
This patch introduces some extra safety checks in journal processing,
and cleans up the code a little bit.

 * moved journal initialization to its own function; main() is cleaner

 * any time we process a file, log the results
   (previous code only loggded if there was a valid entry)

 * After reading journals at startup, only trigger full flush out to disk
   if the user specified -F.  Avoids unnecessary IO on startup unless the
   user also wants unnecessary IO on shutdown.

 * journal_replay is much more careful about files it will open
     * must be a regular file
     * must be owned by daemon user
     * must not be group/other writable

 * Ensure that the journal gets created with the right permissions.
    ... even when the daemon is invoked with a permissive umask.
    equivalent to "chmod a-x,go-w"

-- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1586 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoaniel Pocock reported that the argument may be NULL in low-diskspace
oetiker [Tue, 7 Oct 2008 15:37:34 +0000 (15:37 +0000)]
aniel Pocock reported that the argument may be NULL in low-diskspace
situations, so check for that here to prevent a segmentation fault.
-- Florian Forster

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1584 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoMakefile.lua is now generated
oetiker [Mon, 6 Oct 2008 19:14:17 +0000 (19:14 +0000)]
Makefile.lua is now generated

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1583 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoadded missing file from lua 5.0 integration patch
oetiker [Mon, 6 Oct 2008 19:13:30 +0000 (19:13 +0000)]
added missing file from lua 5.0 integration patch

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1582 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis patch introduces "BATCH" mode.
oetiker [Mon, 6 Oct 2008 19:05:47 +0000 (19:05 +0000)]
This patch introduces "BATCH" mode.

In this mode, a client can feed multiple commands to rrdcached without
waiting for acknowledgement.  This permits multiple commands to be sent
for each read()/write().  This can dramatically increase the command
throughput by increasing the amount of work done per system call.

It enables over 100k updates/second with no CPU
utilization due to the reduced system calls.

-- kevin brintnall

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1581 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis patch introduces buffered I/O to rrdcached. Now, rrdcached can
oetiker [Mon, 6 Oct 2008 19:04:48 +0000 (19:04 +0000)]
This patch introduces buffered I/O to rrdcached.  Now, rrdcached can
interpret as many commands as arrive in a single read(), and it will use
fewer write()s when there are multiple output lines.

All routines now pass around listen_socket_t objects instead of file
descriptors.

All I/O is now contained in two routines.  It's no longer necessary to
specify the line count in multi-line outputs, since that is calculated
automatically.

This is the foundation for accepting batched commands.
-- kevin brintnall

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1580 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoSupport to Lua 5.0 -- Fidelis Assis
oetiker [Mon, 6 Oct 2008 05:05:19 +0000 (05:05 +0000)]
Support to Lua 5.0 -- Fidelis Assis

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1579 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoinitial librrd file added ... this will need more love since it does
oetiker [Sat, 4 Oct 2008 16:05:11 +0000 (16:05 +0000)]
initial librrd file added ... this will need more love since it does
not pick up any -rpath settings

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1575 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years ago* rrd_resize fixed so that it does NOT alter the original file (mmap side effect)
oetiker [Sat, 4 Oct 2008 13:34:54 +0000 (13:34 +0000)]
* rrd_resize fixed so that it does NOT alter the original file (mmap side effect)
* rrd_resize can can deal with version 4 files, so let it

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1571 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThe patch fixs rrdtools behaviour when presented with trunkated rrd files.
oetiker [Fri, 3 Oct 2008 22:53:28 +0000 (22:53 +0000)]
The patch fixs rrdtools behaviour when presented with trunkated rrd files.

  * Make sure that we do not extend past the end of the
    file when reading the header.

  * Makes sure that the data portion of the file is large enough, based on
    the ds_cnt and the total number of RRA rows

-- kevin brintnall

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1570 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agofolding fix
oetiker [Thu, 2 Oct 2008 19:17:18 +0000 (19:17 +0000)]
folding fix

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1567 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agomissing spaces in extconf.rb caused compile failure -- kevin
oetiker [Thu, 2 Oct 2008 19:08:30 +0000 (19:08 +0000)]
missing spaces in extconf.rb caused compile failure -- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1566 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agopermission fix for rrdcached socket -- Daniel.Pocock
oetiker [Thu, 2 Oct 2008 17:17:58 +0000 (17:17 +0000)]
permission fix for rrdcached socket -- Daniel.Pocock

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1565 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agosince rrdcached uses pthread functions, use the threadsafe version of librrd as well...
oetiker [Wed, 1 Oct 2008 20:22:57 +0000 (20:22 +0000)]
since rrdcached uses pthread functions, use the threadsafe version of librrd as well. This will
also reasolve build problems on boxes there the ptherad functions must be linked explicitly.

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1559 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoClearer explanation on which paths are permitted when -B is supplied -- kevin
oetiker [Wed, 1 Oct 2008 20:04:47 +0000 (20:04 +0000)]
Clearer explanation on which paths are permitted when -B is supplied -- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1558 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoFixes for the following compiler warnings:
oetiker [Wed, 1 Oct 2008 20:01:43 +0000 (20:01 +0000)]
Fixes for the following compiler warnings:

 - unused variable
 - unused parameter
 - assignment / argument discards qualifiers from pointer target type
 - comparison between signed and unsigned
 - too many arguments to function
 - assignment makes pointer from integer without a cast
 - incompatible pointer type
 - differ in signedness
 - implicit declaration of function
 - enumeration value not handled in switch
 - value computed is not used

Most notably, a possible segfault in the Rrd_Lastupdate() code of the TCL
bindings has been fixed.

Also, -Wundef (warn if an undefined identifier is evaluated in an #if
directive) has been removed from CFLAGS. I don't see any problem with letting
undefined identifiers evaluate to "false" in rrdtool. Keeping that option
would produce a lot of (imho unnecessary) errors which would need to be fixed
using ugly preprocessor statements like '#if defined(FOO) && FOO'.

-- Sebastian Harl

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1557 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoI've adapted an init script for rrdcached, and also incorporated it into
oetiker [Wed, 1 Oct 2008 19:48:15 +0000 (19:48 +0000)]
I've adapted an init script for rrdcached, and also incorporated it into
the spec file so that it is deployed with the RPM.

There are also some other changes to the spec file so that I could build
an RPM successfully from trunk.  I'm happy to tidy up the spec file some
more if no one else wants to mandate the best way to do it.

By default, rrdcached runs as nobody.  I've tested this on a server
running Ganglia gmetad.

Regards,

Daniel

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1556 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoNow, moving a value to the head of the queue is O(1). Before it was
oetiker [Wed, 1 Oct 2008 19:44:36 +0000 (19:44 +0000)]
Now, moving a value to the head of the queue is O(1).  Before it was
O(queue size).  This improves performance of individual flushes when
there is a large number of files in the queue.  As a result, we don't
hold the cache_lock as much.

Revamped enqueue_cache_item to take advantage of the new structure.

Renamed _wipe_ci_values to look nicer with other code.

--kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1555 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agolcd is actually gcd!
oetiker [Wed, 1 Oct 2008 16:53:56 +0000 (16:53 +0000)]
lcd is actually gcd!

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1552 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoWhen -B is specified, the daemon will only operate on files within the
oetiker [Tue, 30 Sep 2008 18:44:03 +0000 (18:44 +0000)]
When -B is specified, the daemon will only operate on files within the
base directory.  Symlink detection is omitted for performance reasons (if
a user can create a symlink, they can probably overwrite the RRDs anyway). -- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1551 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years ago check permissions before writing to journal -- kevin
oetiker [Tue, 30 Sep 2008 18:43:15 +0000 (18:43 +0000)]
 check permissions before writing to journal -- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1550 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThe daemon should behave the same way w/r/t files whether we "-g" or not.
oetiker [Tue, 30 Sep 2008 18:42:34 +0000 (18:42 +0000)]
The daemon should behave the same way w/r/t files whether we "-g" or not.
-- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1549 a5681a0c-68f1-0310-ab6d-d61299d08faa

15 years agoThis bug caused the last line in each journal file to be processed a
oetiker [Mon, 29 Sep 2008 20:00:34 +0000 (20:00 +0000)]
This bug caused the last line in each journal file to be processed a
second time.  Since it had been modified due to tokenizing, it failed
syntax check.  The daemon would always record one failed line at
end-of-journal as a result.  No data loss incurred by this bug. -- kevin

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1548 a5681a0c-68f1-0310-ab6d-d61299d08faa