Bacula-users

Re: [Bacula-users] Making backups with FIFOs -- in theory

2008-10-29 23:51:41
Subject: Re: [Bacula-users] Making backups with FIFOs -- in theory
From: Dan Langille <dan AT langille DOT org>
To: cc AT mail.3d DOT hu, bacula-users AT lists.sourceforge DOT net
Date: Wed, 29 Oct 2008 23:47:43 -0400
SZÉKELYI Szabolcs wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> 
> the ability to use FIFOs to produce the data to be backed up is a nice
> feature of Bacula, however, I don't really understand how this can work
> reliably.
> 
> I understand the concept, but I have problems with timing. I did a small
> research on how FIFOs work. Consider the following script:
> 
> ==
> #!/bin/bash
> 
> exec > /dev/null
> 
> mkfifo /tmp/tmpfifo
> 
> (
>   for n in `seq 20`; do
>     echo $n >/tmp/tmpfifo
>     sleep 1
>   done
> ) &
> ==
> 
> Let's use this script to generate the data to be backed up, so it is run
> from RunBeforeJob. Creates a FIFO, writes the numbers from 1 to 20 into
> it, with a 1 second delay between them. The loop runs in the background,
> so the well-known deadlock with Bacula waiting for RunBeforeJob waiting
> for Bacula to read the FIFO is avoided.
> 
> When I run this script from a shell, it returns almost immediately as
> expected. Next, running a `cat /tmp/tmpfifo` returns "1". Next time it
> returns "2", up to 20. So it looks like cat reads an EOF after each line.

I do not see how running it from a shell is comparable to a backup job.

> What I can't understand is if Bacula reads a FIFO, how does it know if
> the stream is finished or there's only a small pause in the input (which
> is not unlikely, eg. for database dumps)? Furthermore, if the script
> writing to the FIFO is unable to produce the data at least at the rate
> Bacula can consume it, only half of your data gets backed up, since
> sooner or later Bacula will catch up with the data producer and read an
> EOF from the FIFO (like cat does above).

Have you let such a job run to completion?

How do you know this example loop is representative of what a FIFO would do?

> Can you confirm that this is a real threat or am I overlooking something?

I think people much smarter than you or I have created and tested this. 
  People have been using FIFO in production for some time.  I also think 
your question is not Bacula specific but FIFO generic.

My conclusion: it works.  It is not a real 'threat'.

I say this completely without knowing much about FIFO but with the 
knowledge of the experience level of the people who implemented it.  :)



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users