]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/2.0.3-verify.patch
ebl update todolist
[bacula/bacula] / bacula / patches / 2.0.3-verify.patch
1 This patch should fix the problem reported in bug #803 where a Verify 
2 job select the JobId to verified at schedule time rather than at runtime.
3 This makes it difficult or impossible to schedule a verify just after
4 a backup.
5
6 Apply this patch to Bacula version 2.0.3 (probably 2.0.2 as well) with:
7
8   cd <bacula-source>
9   patch -p0 <2.0.3-verify.patch
10   make
11   ...
12   make install
13
14 Index: src/dird/verify.c
15 ===================================================================
16 --- src/dird/verify.c   (revision 4353)
17 +++ src/dird/verify.c   (working copy)
18 @@ -1,22 +1,7 @@
19  /*
20 - *
21 - *   Bacula Director -- verify.c -- responsible for running file verification
22 - *
23 - *     Kern Sibbald, October MM
24 - *
25 - *  Basic tasks done here:
26 - *     Open DB
27 - *     Open connection with File daemon and pass him commands
28 - *       to do the verify.
29 - *     When the File daemon sends the attributes, compare them to
30 - *       what is in the DB.
31 - *
32 - *   Version $Id$
33 - */
34 -/*
35     Bacula® - The Network Backup Solution
36  
37 -   Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
38 +   Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
39  
40     The main author of Bacula is Kern Sibbald, with contributions from
41     many others, a complete list can be found in the file AUTHORS.
42 @@ -40,6 +25,21 @@
43     (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
44     Switzerland, email:ftf@fsfeurope.org.
45  */
46 +/*
47 + *
48 + *   Bacula Director -- verify.c -- responsible for running file verification
49 + *
50 + *     Kern Sibbald, October MM
51 + *
52 + *  Basic tasks done here:
53 + *     Open DB
54 + *     Open connection with File daemon and pass him commands
55 + *       to do the verify.
56 + *     When the File daemon sends the attributes, compare them to
57 + *       what is in the DB.
58 + *
59 + *   Version $Id$
60 + */
61  
62  
63  #include "bacula.h"
64 @@ -66,6 +66,22 @@
65   */
66  bool do_verify_init(JCR *jcr) 
67  {
68 +   return true;
69 +}
70 +
71 +
72 +/*
73 + * Do a verification of the specified files against the Catlaog
74 + *
75 + *  Returns:  false on failure
76 + *            true  on success
77 + */
78 +bool do_verify(JCR *jcr)
79 +{
80 +   const char *level;
81 +   BSOCK   *fd;
82 +   int stat;
83 +   char ed1[100];
84     JOB_DBR jr;
85     JobId_t verify_jobid = 0;
86     const char *Name;
87 @@ -74,12 +90,16 @@
88  
89     memset(&jcr->previous_jr, 0, sizeof(jcr->previous_jr));
90  
91 -   Dmsg1(9, "bdird: created client %s record\n", jcr->client->hdr.name);
92 -
93     /*
94 -    * Find JobId of last job that ran.  E.g.
95 -    *   for VERIFY_CATALOG we want the JobId of the last INIT.
96 -    *   for VERIFY_VOLUME_TO_CATALOG, we want the JobId of the
97 +    * Find JobId of last job that ran. Note, we do this when
98 +    *   the job actually starts running, not at schedule time,
99 +    *   so that we find the last job that terminated before
100 +    *   this job runs rather than before it is scheduled. This
101 +    *   permits scheduling a Backup and Verify at the same time,
102 +    *   but with the Verify at a lower priority.
103 +    *
104 +    *   For VERIFY_CATALOG we want the JobId of the last INIT.
105 +    *   For VERIFY_VOLUME_TO_CATALOG, we want the JobId of the
106      *       last backup Job.
107      */
108     if (jcr->JobLevel == L_VERIFY_CATALOG ||
109 @@ -89,7 +109,7 @@
110        if (jcr->verify_job &&
111            (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG ||
112             jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG)) {
113 -         Name = jcr->verify_job->hdr.name;
114 +         Name = jcr->verify_job->name();  
115        } else {
116           Name = NULL;
117        }
118 @@ -149,23 +169,7 @@
119        jcr->fileset = jcr->verify_job->fileset;
120     }
121     Dmsg2(100, "ClientId=%u JobLevel=%c\n", jcr->previous_jr.ClientId, jcr->JobLevel);
122 -   return true;
123 -}
124  
125 -
126 -/*
127 - * Do a verification of the specified files against the Catlaog
128 - *
129 - *  Returns:  false on failure
130 - *            true  on success
131 - */
132 -bool do_verify(JCR *jcr)
133 -{
134 -   const char *level;
135 -   BSOCK   *fd;
136 -   int stat;
137 -   char ed1[100];
138 -
139     if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) {
140        Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
141        return false;