From: Eric Bollengier Date: Fri, 24 Apr 2020 16:20:13 +0000 (+0200) Subject: BEE Backport bacula/src/dird/verify.c X-Git-Tag: Release-11.3.2~1730 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d5898484bb7e97fd9250e982ba14b3bb5141946;p=thirdparty%2Fbacula.git BEE Backport bacula/src/dird/verify.c This commit is the result of the squash of the following main commits: Author: Eric Bollengier 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 Date: Tue Mar 27 14:54:12 2018 +0200 Do not use static buffer in level_to_str() Author: Wanderlei Huttel Date: Wed Jul 26 13:30:26 2017 +0200 Enhance verify job report from bug 2249 Author: Eric Bollengier Date: Mon Feb 8 21:05:13 2016 +0100 Add accurate mode to verify data Author: Eric Bollengier Date: Mon Aug 26 13:57:34 2013 +0200 Merge Filename table to File --- diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 2dae90ccc2..392ab7e0cc 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -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) {