[rrd-developers] [PATCH] signal handler changes and "fast shutdown" mode

kevin brintnall kbrint at rufus.net
Sat Sep 27 00:28:30 CEST 2008

Two patches to follow:

(1) initialize signal handlers in their own function
    - slims down daemonize()
    - common signal handler code reduced
    - signal behavior documented

(2) "fast shutdown" mode
    - exit without flushing updates to disk (flush only the journal)
    - clients and listen thread are stopped immediately
    - added additional handlers SIGUSR1 and SIGUSR2

There has been a lot of debate over (2).  Here's what I added:

If journaling is disabled, updates are always flushed out to disk before

If journaling is enabled, the default is to do "fast shutdown"; the
journal is sync'ed out to disk, but the RRD updates are not.  They must be
re-played from journal next time the daemon starts up.

To override the default behavior, the -F argument will cause rrdcached to
always sync updates out to disk (even when journaling).  This may take
longer, but some people want it that way.

To override the options the daemon was started with, two new signal
handlers have been introduced.

 SIGUSR1 = exit, flushing all updates out to disk
 SIGUSR2 = exit without flushing updates to disk ("fast shutdown")

To summarize:

	-j	= "fast shutdown", journaling enabled
	-j -F	= flush then shutdown, journaling enabled
	!-j	= flush then shutdown, no journaling (not recommended)
	SIGUSR1 = flush then shutdown, regardless of -j/-F
	SIGUSR2 = "fast shutdown", regardless of -j/-F

This makes the default behavior very sane, but allows administrators to
tailor the daemon to fit their needs.

Feedback is welcome.

More information about the rrd-developers mailing list