]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport bacula/src/dird/verify.c
authorEric Bollengier <eric@baculasystems.com>
Fri, 24 Apr 2020 16:20:13 +0000 (18:20 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 29 Apr 2021 08:44:17 +0000 (10:44 +0200)
This commit is the result of the squash of the following main commits:

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Thu Feb 7 15:43:50 2019 +0100

    Print Job message in Verify Jobs when the number of files found is not the one expected

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Tue Mar 27 14:54:12 2018 +0200

    Do not use static buffer in level_to_str()

Author: Wanderlei Huttel <wanderleihuttel@gmail.com>
Date:   Wed Jul 26 13:30:26 2017 +0200

    Enhance verify job report from bug 2249

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Mon Feb 8 21:05:13 2016 +0100

    Add accurate mode to verify data

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Mon Aug 26 13:57:34 2013 +0200

    Merge Filename table to File

bacula/src/dird/verify.c

index 2dae90ccc2bf15d80f695185254361637ee61c38..392ab7e0cc7694a4a43a90f631d1f0932347ac89 100644 (file)
@@ -17,6 +17,7 @@
    Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
+ *
  *   Bacula Director -- verify.c -- responsible for running file verification
  *
  *     Kern Sibbald, October MM
@@ -27,6 +28,7 @@
  *       to do the verify.
  *     When the File daemon sends the attributes, compare them to
  *       what is in the DB.
+ *
  */
 
 
@@ -240,7 +242,8 @@ bool do_verify(JCR *jcr)
 
    /* Print Job Start message */
    Jmsg(jcr, M_INFO, 0, _("Start Verify JobId=%s Level=%s Job=%s\n"),
-      edit_uint64(jcr->JobId, ed1), level_to_str(edl, sizeof(edl), jcr->getJobLevel()), jcr->Job);
+        edit_uint64(jcr->JobId, ed1),
+        level_to_str(edl, sizeof(edl), jcr->getJobLevel()), jcr->Job);
 
    if (jcr->getJobLevel() == L_VERIFY_VOLUME_TO_CATALOG ||
        jcr->getJobLevel() == L_VERIFY_DATA)
@@ -309,7 +312,7 @@ bool do_verify(JCR *jcr)
       break;
    case L_VERIFY_DATA:
       send_accurate_current_files(jcr);
-      /* Fall-through wanted */
+      /* Wanted */
    case L_VERIFY_VOLUME_TO_CATALOG:
       if (jcr->sd_calls_client) {
          if (jcr->FDVersion < 10) {
@@ -448,6 +451,8 @@ void verify_cleanup(JCR *jcr, int TermCode)
       jcr->ExpectedFiles, jcr->JobFiles);
    if ((jcr->getJobLevel() == L_VERIFY_VOLUME_TO_CATALOG || jcr->getJobLevel() == L_VERIFY_DATA) &&
        jcr->ExpectedFiles != jcr->JobFiles) {
+      Jmsg(jcr, M_ERROR, 0, _("The Verify Job has analyzed %d file(s) but it was expecting %d file(s)\n"),
+           jcr->JobFiles, jcr->ExpectedFiles);
       TermCode = JS_ErrorTerminated;
    }
 
@@ -700,6 +705,8 @@ void get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId)
          /*
           * Loop over options supplied by user and verify the
           * fields he requests.
+          *
+          * Keep this list synchronized with the configuration parser in inc_conf.c and in BWeb
           */
          for (p=Opts_Digest; *p; p++) {
             char ed1[30], ed2[30];
@@ -839,11 +846,10 @@ void get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId)
     */
    jcr->fn_printed = false;
    bsnprintf(buf, sizeof(buf),
-    "SELECT Path.Path,Filename.Name FROM File,Path,Filename "
-    "WHERE File.JobId=%d AND File.FileIndex > 0 "
-    "AND File.MarkId!=%d AND File.PathId=Path.PathId "
-    "AND File.FilenameId=Filename.FilenameId",
-       JobId, jcr->JobId);
+      "SELECT Path.Path,File.Filename FROM File,Path "
+       "WHERE File.JobId=%d AND File.FileIndex > 0 "
+         "AND File.MarkId!=%d AND File.PathId=Path.PathId ",
+         JobId, jcr->JobId);
    /* missing_handler is called for each file found */
    db_sql_query(jcr->db, buf, missing_handler, (void *)jcr);
    if (jcr->fn_printed) {