From: Kern Sibbald Date: Thu, 16 May 2019 15:43:41 +0000 (+0200) Subject: Turn on cleanup_incomplete() X-Git-Tag: Release-9.4.4~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d0c6fc19c5eb4dd9e69df4477d712e2c59853d5;p=thirdparty%2Fbacula.git Turn on cleanup_incomplete() --- diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index 55f01b671..9c39ae428 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -779,9 +779,6 @@ int wait_for_job_termination(JCR *jcr, int timeout) return jcr->SDJobStatus; } -/* Not used */ -#if 0 - /* When the job is incomplete, we need to make sure the catalog * is consistent. The JobMedia table should reference Files that * are not in the file table for example. @@ -868,7 +865,6 @@ bail_out: db_end_transaction(jcr, jcr->db); db_unlock(jcr->db); } -#endif /* * Release resources allocated during backup. @@ -891,10 +887,8 @@ void backup_cleanup(JCR *jcr, int TermCode) remove_dummy_jobmedia_records(jcr); -#if 0 /* cleanup the job media table after an incomplete job, should not be needed */ incomplete_cleanup(jcr); -#endif if (jcr->is_JobLevel(L_VIRTUAL_FULL)) { vbackup_cleanup(jcr, TermCode); @@ -1158,7 +1152,8 @@ void update_bootstrap_file(JCR *jcr) /* Start output with when and who wrote it */ bstrftimes(edt, sizeof(edt), time(NULL)); fprintf(fd, "# %s - %s - %s%s\n", edt, jcr->jr.Job, - level_to_str(edl, sizeof(edl), jcr->getJobLevel()), jcr->since); + level_to_str(edl, sizeof(edl), jcr->getJobLevel()), + jcr->since); for (int i=0; i < VolCount; i++) { /* Write the record */ fprintf(fd, "Volume=\"%s\"\n", VolParams[i].VolumeName); diff --git a/regress/scripts/functions.pm b/regress/scripts/functions.pm index 2942980c3..2c4f52240 100644 --- a/regress/scripts/functions.pm +++ b/regress/scripts/functions.pm @@ -446,7 +446,10 @@ sub check_jobmedia open(FP, "|$bin/bconsole -c $conf/bconsole.conf >$tmp/check_jobmedia.$$"); print FP "\@echo File generated by scripts::function::check_jobmedia()\n"; print FP "sql\n"; - print FP "SELECT 'ERROR with FirstIndex not starting at 1 (JobId|FirstIndex)', JobId, Min(FirstIndex) AS A FROM JobMedia GROUP BY JobId HAVING Min(FirstIndex) > 1;\n"; + if ($TestName !~ /(restart|incomplete)-/) { + print FP "SELECT 'ERROR with FirstIndex not starting at 1 (JobId|FirstIndex)', JobId, Min(FirstIndex) AS A FROM JobMedia GROUP BY JobId HAVING Min(FirstIndex) > 1;\n"; + } + print FP "SELECT 'ERROR with FirstIndex greater than LastIndex', JobId, JobMediaId, FirstIndex, LastIndex FROM JobMedia WHERE FirstIndex > LastIndex;\n"; print FP "SELECT 'ERROR with LastIndex != JobFiles (JobId|LastIndex|JobFiles)', JobId, Max(LastIndex), JobFiles FROM Job JOIN JobMedia USING (JobId) WHERE JobStatus = 'T' AND Type = 'B' GROUP BY JobId,JobFiles HAVING Max(LastIndex) != JobFiles;\n"; print FP "SELECT 'Index', JobId, FirstIndex, LastIndex, JobMediaId FROM JobMedia ORDER BY JobId, JobMediaId;\n"; print FP "SELECT 'Block', JobId, MediaId, StartFile, EndFile, StartBlock, EndBlock, JobMediaId FROM JobMedia ORDER BY JobId, JobMediaId;\n"; @@ -474,6 +477,10 @@ sub check_jobmedia } elsif ($l =~ /Index\s*!\s*(\d+)\s*!\s*(\d+)\s*!\s*(\d+)\s*!/) { my ($jobid, $first, $last) = ($1, $2, $3); + # incomplete tests are creating gaps in the FileIndex, no need to report these errors + next if ($TestName =~ /(restart|incomplete)[0-9]?-/); + + # Skip dummy records next if ($first == 0 && $last == 0); if ($jobs{$jobid} && !($jobs{$jobid} == $first || $jobs{$jobid} == ($first - 1))) {