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