[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bacula-devel] Automatic labeling (bug 1014)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Greetings all.  I've been working at tracking down what I thought was a
bug in Bacula.  Automatic volume labels prior to Bacula 2.2.5 were based
on the number of volumes in the pool where the new media is created and
in that version a change was made so that the incremental component of
the label was based on the maximum media ID across all volumes.  The
original behavior is restored by slightly modifying the SQL in newvol.c:

SELECT MAX(MediaId) FROM Media,Pool WHERE Pool.PoolId=%s

To:

SELECT COALESCE(MAX(MediaId), 0) FROM Media WHERE PoolId=%s

So just as I was about to mail that, I found bug 1014
(http://bugs.bacula.org/view.php?id=1014) which describes this as
changed behavior and the documentation was updated to reflect that.  I
can't tell from the bug if this is intentional or not, but to me it
seems very much like a regression.  Consider a site with multiple pools,
one for each type of backup.  You might have the numbers in your labels
scattered across all of your pools, so instead of "FULL0001, FULL0002,
INC0001, INC0002" you would have "FULL0001, INC0002, FULL0004, INC0004".
 This is also a problem since labels for the tapes are usually ordered
in bulk (like say FULL0001 to FULL0120) and skipped numbers will just
lead to confusion.

I found a reference on newvol.c to a bug 921, but I'd think that the fix
for that causes a larger bug.

	Luke Reeves
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHniLjE5thtAlvRxIRAvfbAJ9aOdtKLgJO7iKa9+TMSO3GSANBvACbBfCF
+lRMiEOChp0Pcj1YJzMsiOE=
=F4hq
-----END PGP SIGNATURE-----
Index: /bacula/src/dird/newvol.c
===================================================================
--- /bacula/src/dird/newvol.c	(revision 6334)
+++ /bacula/src/dird/newvol.c	(working copy)
@@ -124,7 +124,7 @@
    mr->VolumeName[0] = 0;
    bstrncpy(name, pr->LabelFormat, sizeof(name));
    ctx.value = 0;
-   Mmsg(query, "SELECT MAX(MediaId) FROM Media,Pool WHERE Pool.PoolId=%s", 
+   Mmsg(query, "SELECT COALESCE(MAX(MediaId), 0) FROM Media WHERE PoolId=%s", 
         edit_int64(pr->PoolId, ed1));
    if (!db_sql_query(jcr->db, query.c_str(), db_int64_handler, (void *)&ctx)) {
       Jmsg(jcr, M_WARNING, 0, _("SQL failed, but ignored. ERR=%s\n"), db_strerror(jcr->db));
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bacula-devel mailing list
Bacula-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bacula-devel


This mailing list archive is a service of Copilotco.