From: Kern Sibbald Date: Thu, 2 Jul 2009 09:22:20 +0000 (+0000) Subject: Another fix for bug #1311 to get the correct last_full_time X-Git-Tag: Release-7.0.0~2925 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b401b89cc54b8f8e1cd032476833daf461ba0d07;p=bacula%2Fbacula Another fix for bug #1311 to get the correct last_full_time git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8944 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/sql_find.c b/bacula/src/cats/sql_find.c index 82e914e46b..1ce51e3ff1 100644 --- a/bacula/src/cats/sql_find.c +++ b/bacula/src/cats/sql_find.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2008 Free Software Foundation Europe e.V. + Copyright (C) 2000-2009 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. @@ -57,7 +57,7 @@ /* * Find job start time if JobId specified, otherwise - * find last full save for Incremental and Differential saves. + * find last Job start time Incremental and Differential saves. * * StartTime is returned in stime * @@ -75,8 +75,8 @@ db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime) pm_strcpy(stime, "0000-00-00 00:00:00"); /* default */ /* If no Id given, we must find corresponding job */ if (jr->JobId == 0) { - /* Differential is since last Full backup */ - Mmsg(mdb->cmd, + /* Differential is since last Full backup */ + Mmsg(mdb->cmd, "SELECT StartTime FROM Job WHERE JobStatus IN ('T','W') AND Type='%c' AND " "Level='%c' AND Name='%s' AND ClientId=%s AND FileSetId=%s " "ORDER BY StartTime DESC LIMIT 1", diff --git a/bacula/src/dird/fd_cmds.c b/bacula/src/dird/fd_cmds.c index 4137fdfdfa..762850e5be 100644 --- a/bacula/src/dird/fd_cmds.c +++ b/bacula/src/dird/fd_cmds.c @@ -197,9 +197,16 @@ void get_level_since_time(JCR *jcr, char *since, int since_len) /* Look up start time of last Full job */ now = (utime_t)time(NULL); jcr->jr.JobId = 0; /* flag to return since time */ - have_full = db_find_job_start_time(jcr, jcr->db, &jcr->jr, &jcr->stime); + /* + * This is probably redundant, but some of the code below + * uses jcr->stime, so don't remove unless you are sure. + */ + if (!db_find_job_start_time(jcr, jcr->db, &jcr->jr, &jcr->stime)) { + do_full = true; + } + have_full = db_find_last_job_start_time(jcr, jcr->db, &jcr->jr, &stime, L_FULL); if (have_full) { - last_full_time = str_to_utime(jcr->stime); + last_full_time = str_to_utime(stime); } else { do_full = true; /* No full, upgrade to one */ } diff --git a/bacula/src/version.h b/bacula/src/version.h index e8bc44b0cd..4c3741e95e 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "3.0.2" -#define BDATE "01 July 2009" -#define LSMDATE "01Jul09" +#define BDATE "02 July 2009" +#define LSMDATE "02Jul09" #define PROG_COPYRIGHT "Copyright (C) %d-2009 Free Software Foundation Europe e.V.\n" #define BYEAR "2009" /* year for copyright messages in progs */ diff --git a/bacula/technotes b/bacula/technotes index e20801290f..959cbf212b 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -2,6 +2,8 @@ General: +02Jul09 +kes Another fix for bug #1311 to get the correct last_full_time 01Jul09 kes Fix bug #1317 Allow duplicate jobs = no does not work kes Eliminate double job report when do_xxx_init() returns failure