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.
db_end_transaction(jcr, jcr->db);
db_unlock(jcr->db);
}
-#endif
/*
* Release resources allocated during backup.
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);
/* 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);
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";
} 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))) {