New cached function: pause/resume

Steve Shipway <[email protected]>
Newsgroups gmane.comp.db.rrdtool.devel
Message-ID <28E447343A85354483BCF7C3E9D5EAA514A6FEE7@uxcn10-1.UoA.auckland.ac.nz>
I've developed a couple of new functions for the rrdcached - PAUSE and RESUME cause the write threads to be paused and resumed, allowing the RRD file to be quiesced temporarily for backup purposes.  During the paused time, incoming updates simply go into the queue and so are not lost, though the memory footprint of the rrdcached will slowly go up.

To control this, I've had to add new commands to the rrdtool client.  At Tobi's suggestion, this has been done by adding a new 'daemonctl' command, and absorbing the old 'flushcached' command into this.

Now we have:

rrdtool daemonctl [ flush [<file> ...]|pause|resume|stat ] [ --daemon <address> ]

So, the old 'rrdtool flushcached' has been replaced by 'rrdtool daemonctl flush'.  Also, it can be called with NO file arguments, which results in a FLUSHALL command being sent to the daemon.  To enable this, a new function rrdc_flushall has been added to the API.

The current version disables the flushcached command in the Windows build - since I don't know the reasoning behind this, I have also disabled the daemonctl command in the Windows build, but would like to hear from any Windows person who might know the reason for this.  Maybe we can re-enable it?

The patch for this involves some new files ( rrddaemonctl.pod, rrd_pausecached.c, rrd_resumecached.c, rrd_cachedstat.c ), killing off an old file (rrdflushcached.pod) and modifications to rrd.h, rrd_tool.c, rrd_client.c, librrd.sym.in, Makefile.am.

Example:
[root@slayer src]# export RRDCACHED_ADDRESS=localhost
[root@slayer src]# ./rrdtool daemonctl flush
[root@slayer src]# ./rrdtool daemonctl flush foo.rrd
[root@slayer src]# ./rrdtool daemonctl flush foo.rrd --daemon localhost
[root@slayer src]# ./rrdtool daemonctl flush bar.rrd
ERROR: Flushing of file "bar.rrd" failed: rrdcached: No such file: /u01/rrdtool.test.1.4/bar.rrd.. Skipping remaining 0 files.
[root@slayer src]# ./rrdtool daemonctl pause
[root@slayer src]# ./rrdtool daemonctl flush foo.rrd
ERROR: Flushing of file "foo.rrd" failed: rrdcached: Write threads are paused. Use RESUME to restart.. Skipping remaining 0 files.
[root@slayer src]# ./rrdtool daemonctl flush
ERROR: rrdcached: Write threads are paused. Use RESUME to restart.
[root@slayer src]# ./rrdtool daemonctl resume
[root@slayer src]# ./rrdtool daemonctl resume foo
ERROR: Usage: rrdtool resume [--daemon <addr>]
[root@slayer src]# ./rrdtool daemonctl stats
QueueLength = 0
UpdatesReceived = 0
FlushesReceived = 3
UpdatesWritten = 0
DataSetsWritten = 0
TreeNodesNumber = 0
TreeDepth = 0
JournalBytes = 0
JournalRotate = 0
Paused = 0
[root@slayer src]# ./rrdtool daemonctl
RRDtool 1.4.99911011600  Copyright 1997-2009 by Tobias Oetiker <[email protected]>
               Compiled Jan 20 2011 14:24:56

Usage: rrdtool [options] command command_options
* daemonctl - control rrdcached daemon

  flush - flush cached data out to an RRD file
        rrdtool daemonctl flush [filename.rrd] [--daemon <address>]
  pause - pause the writing threads of cache daemon
        rrdtool daemonctl pause [--daemon <address>]
  resume - resume writing threads of cache daemon
        rrdtool daemonctl resume [--daemon <address>]
  stats - show statistics of cache daemon
        rrdtool daemonctl stats [--daemon <address>]


RRDtool is distributed under the Terms of the GNU General
Public License Version 2. (www.gnu.org/copyleft/gpl.html)

For more information read the RRD manpages

[root@slayer src]#

Any thoughts/opinions from the community?

Steve

________________________________
Steve Shipway
ITS Unix Services Design Lead
University of Auckland, New Zealand
Floor 1, 58 Symonds Street, Auckland
Phone: +64 (0)9 3737599 ext 86487
DDI: +64 (0)9 924 6487
Mobile: +64 (0)21 753 189
Email: [email protected]<mailto:[email protected]>
P Please consider the environment before printing this e-mail

_______________________________________________
rrd-developers mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
rrd-pause-diff (application/octet-stream, 32.1 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.