This patch should fix the problem reported in bug #803 where a Verify job select the JobId to verified at schedule time rather than at runtime. This makes it difficult or impossible to schedule a verify just after a backup. Apply this patch to Bacula version 2.0.3 (probably 2.0.2 as well) with: cd patch -p0 <2.0.3-verify.patch make ... make install Index: src/dird/verify.c =================================================================== --- src/dird/verify.c (revision 4353) +++ src/dird/verify.c (working copy) @@ -40,6 +25,21 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * + * Bacula Director -- verify.c -- responsible for running file verification + * + * Kern Sibbald, October MM + * + * Basic tasks done here: + * Open DB + * Open connection with File daemon and pass him commands + * to do the verify. + * When the File daemon sends the attributes, compare them to + * what is in the DB. + * + * Version $Id$ + */ #include "bacula.h" @@ -66,6 +66,22 @@ */ bool do_verify_init(JCR *jcr) { + return true; +} + + +/* + * Do a verification of the specified files against the Catlaog + * + * Returns: false on failure + * true on success + */ +bool do_verify(JCR *jcr) +{ + const char *level; + BSOCK *fd; + int stat; + char ed1[100]; JOB_DBR jr; JobId_t verify_jobid = 0; const char *Name; @@ -74,12 +90,16 @@ memset(&jcr->previous_jr, 0, sizeof(jcr->previous_jr)); - Dmsg1(9, "bdird: created client %s record\n", jcr->client->hdr.name); - /* - * Find JobId of last job that ran. E.g. - * for VERIFY_CATALOG we want the JobId of the last INIT. - * for VERIFY_VOLUME_TO_CATALOG, we want the JobId of the + * Find JobId of last job that ran. Note, we do this when + * the job actually starts running, not at schedule time, + * so that we find the last job that terminated before + * this job runs rather than before it is scheduled. This + * permits scheduling a Backup and Verify at the same time, + * but with the Verify at a lower priority. + * + * For VERIFY_CATALOG we want the JobId of the last INIT. + * For VERIFY_VOLUME_TO_CATALOG, we want the JobId of the * last backup Job. */ if (jcr->JobLevel == L_VERIFY_CATALOG || @@ -89,7 +109,7 @@ if (jcr->verify_job && (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG || jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG)) { - Name = jcr->verify_job->hdr.name; + Name = jcr->verify_job->name(); } else { Name = NULL; } @@ -149,23 +169,7 @@ jcr->fileset = jcr->verify_job->fileset; } Dmsg2(100, "ClientId=%u JobLevel=%c\n", jcr->previous_jr.ClientId, jcr->JobLevel); - return true; -} - -/* - * Do a verification of the specified files against the Catlaog - * - * Returns: false on failure - * true on success - */ -bool do_verify(JCR *jcr) -{ - const char *level; - BSOCK *fd; - int stat; - char ed1[100]; - if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); return false;