From 9ca518ceea4b051e52b04aca91e71e95ad940bbf Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 28 Feb 2007 10:33:19 +0000 Subject: [PATCH] 28Feb07 kes Correct typeo in var.c patch. 27Feb07 kes Don't let Bacula prune File or Job records for the current Job. kes Fix variable substitution pad + inc bug reported (with patch) in bug #791. 26Feb07 kes Correct SQLite log table index as reported by Luca Berra git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.0@4278 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/INSTALL | 5 +++ bacula/README | 10 ++---- bacula/src/cats/make_sqlite3_tables.in | 2 +- bacula/src/cats/make_sqlite_tables.in | 2 +- bacula/src/dird/ua_prune.c | 46 +++++++++++++++----------- bacula/src/lib/var.c | 5 +-- bacula/src/version.h | 4 +-- bacula/technotes-2.0 | 8 +++++ 8 files changed, 50 insertions(+), 32 deletions(-) diff --git a/bacula/INSTALL b/bacula/INSTALL index 41f8213921..2dd8a48eda 100644 --- a/bacula/INSTALL +++ b/bacula/INSTALL @@ -1,3 +1,8 @@ + +This file is rather out of date, and if you want to avoid a lot +of pain, you will read the manual, which you can find at www.bacula.org + + -------------------------------------------------------------------------- Using GNU autoconfig -------------------------------------------------------------------------- diff --git a/bacula/README b/bacula/README index ea5a760f3d..67c06b806b 100644 --- a/bacula/README +++ b/bacula/README @@ -4,6 +4,8 @@ to read the online manual at: http://www.bacula.org +You will save yourself a lot of pain if you read +the manual -- it is online at the above site. Barring reading the manual, you might try the following: @@ -14,19 +16,13 @@ To Configure it: --sysconfdir=$HOME/bacula/bin \ --with-pid-dir=$HOME/bacula/bin \ --with-subsys-dir=$HOME/bacula/bin \ - --with-sqlite=$HOME/depkgs/sqlite \ --enable-gnome \ - --with-mysql=$HOME/mysql \ + --with-mysql \ --with-working-dir=$HOME/bacula/bin/working \ --with-dump-email=YOUR_EMAIL_ADDRESS \ --with-job-email=YOUR_EMAIL_ADDRESS \ --with-smtp-host=YOUR_SMTP_SERVER_ADDRESS -If you want to use SQLite, please download depkgs and -build sqlite, then add something like: - - --with-sqlite=$HOME/depkgs/sqlite - Build Bacula: diff --git a/bacula/src/cats/make_sqlite3_tables.in b/bacula/src/cats/make_sqlite3_tables.in index fe44892255..9fcbb6c6c8 100644 --- a/bacula/src/cats/make_sqlite3_tables.in +++ b/bacula/src/cats/make_sqlite3_tables.in @@ -101,7 +101,7 @@ CREATE TABLE Log ( LogText TEXT NOT NULL, PRIMARY KEY(LogId) ); -CREATE INDEX LogInx1 ON File (JobId); +CREATE INDEX LogInx1 ON Log (JobId); CREATE TABLE FileSet ( diff --git a/bacula/src/cats/make_sqlite_tables.in b/bacula/src/cats/make_sqlite_tables.in index fe44892255..9fcbb6c6c8 100644 --- a/bacula/src/cats/make_sqlite_tables.in +++ b/bacula/src/cats/make_sqlite_tables.in @@ -101,7 +101,7 @@ CREATE TABLE Log ( LogText TEXT NOT NULL, PRIMARY KEY(LogId) ); -CREATE INDEX LogInx1 ON File (JobId); +CREATE INDEX LogInx1 ON Log (JobId); CREATE TABLE FileSet ( diff --git a/bacula/src/dird/ua_prune.c b/bacula/src/dird/ua_prune.c index 52fb760520..8faa8aec9a 100644 --- a/bacula/src/dird/ua_prune.c +++ b/bacula/src/dird/ua_prune.c @@ -1,16 +1,7 @@ -/* - * - * Bacula Director -- User Agent Database prune Command - * Applies retention periods - * - * Kern Sibbald, February MMII - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2006 Free Software Foundation Europe e.V. + Copyright (C) 2002-2007 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -34,6 +25,15 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * + * Bacula Director -- User Agent Database prune Command + * Applies retention periods + * + * Kern Sibbald, February MMII + * + * Version $Id$ + */ #include "bacula.h" #include "dird.h" @@ -267,11 +267,15 @@ int prune_files(UAContext *ua, CLIENT *client) db_sql_query(ua->db, query, file_delete_handler, (void *)&del); for (i=0; i < del.num_ids; i++) { - purge_files_from_job(ua, del.JobId[i]); + /* Don't prune current job */ + if (ua->jcr->JobId != del.JobId[i]) { + purge_files_from_job(ua, del.JobId[i]); + del.num_del++; + } } - edit_uint64_with_commas(del.num_ids, ed1); + edit_uint64_with_commas(del.num_del, ed1); bsendmsg(ua, _("Pruned Files from %s Jobs for client %s from catalog.\n"), - ed1, client->hdr.name); + ed1, client->name()); bail_out: db_unlock(ua->db); @@ -418,13 +422,17 @@ int prune_jobs(UAContext *ua, CLIENT *client, int JobType) * Then delete the Job entry, and finally and JobMedia records. */ for (i=0; i < del.num_ids; i++) { - if (!del.PurgedFiles[i]) { - purge_files_from_job(ua, del.JobId[i]); + /* Don't prune current job */ + if (ua->jcr->JobId != del.JobId[i]) { + if (!del.PurgedFiles[i]) { + purge_files_from_job(ua, del.JobId[i]); + } + purge_job_from_catalog(ua, del.JobId[i]); + del.num_del++; } - purge_job_from_catalog(ua, del.JobId[i]); } - bsendmsg(ua, _("Pruned %d %s for client %s from catalog.\n"), del.num_ids, - del.num_ids==1?_("Job"):_("Jobs"), client->hdr.name); + bsendmsg(ua, _("Pruned %d %s for client %s from catalog.\n"), del.num_del, + del.num_del==1?_("Job"):_("Jobs"), client->name()); bail_out: drop_temp_tables(ua); @@ -523,7 +531,7 @@ bool prune_volume(UAContext *ua, MEDIA_DBR *mr) continue; } Dmsg2(200, "Looking at %s JobTdate=%d\n", jr.Job, (int)jr.JobTDate); - if (jr.JobTDate >= (now - period)) { + if (jr.JobTDate >= (now - period) || ua->jcr->JobId == del.JobId[i]) { continue; } purge_files_from_job(ua, del.JobId[i]); diff --git a/bacula/src/lib/var.c b/bacula/src/lib/var.c index aac43f66e9..27bf15d75d 100644 --- a/bacula/src/lib/var.c +++ b/bacula/src/lib/var.c @@ -1990,8 +1990,9 @@ parse_variable_complex( rc = VAR_ERR_INCOMPLETE_VARIABLE_SPEC; goto error_return; } - inc = (*p == '+'); /* increment variable */ - p++; + if ((inc = (*p++ == '+'))) { + p++; /* skip the + */ + } /* lookup the variable value now */ if (failed) { diff --git a/bacula/src/version.h b/bacula/src/version.h index c03c05e0c9..09221037cb 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.0.3" -#define BDATE "22 February 2007" -#define LSMDATE "22Feb07" +#define BDATE "28 February 2007" +#define LSMDATE "28Feb07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.0 b/bacula/technotes-2.0 index 8155c296ac..852b56b6cd 100644 --- a/bacula/technotes-2.0 +++ b/bacula/technotes-2.0 @@ -1,6 +1,14 @@ Technical notes on version 2.0 General: +28Feb07 +kes Correct typeo in var.c patch. +27Feb07 +kes Don't let Bacula prune File or Job records for the current Job. +kes Fix variable substitution pad + inc bug reported (with patch) + in bug #791. +26Feb07 +kes Correct SQLite log table index as reported by Luca Berra. 24Feb07 ebl Fix fifo stuff, bacula tries to rewind the fifo... Thanks to Andreas 22Feb07 -- 2.39.5