Bacula-users

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

2008-10-29 19:18:20
Subject: [Bacula-users] Making backups with FIFOs -- in theory
From: SZÉKELYI Szabolcs <cc AT mail.3d DOT hu>
To: bacula-users AT lists.sourceforge DOT net
Date: Wed, 29 Oct 2008 23:58:19 +0100
-----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.

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).

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

[Please keep me Cc'ed in you replies, I'm off-list.]

Thanks,
- --
cc


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkkI6ooACgkQGJRwVVqzMkM5JgCdG4rgbaYRUeq6faO1/WtpPrki
ArEAn1735OTE3qdS8AHc6V7ynNTdZy7m
=9/Wm
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
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