From: Kern Sibbald Date: Mon, 16 Jun 2003 22:12:52 +0000 (+0000) Subject: Fix rescheduling if files saved X-Git-Tag: Release-1.31~71 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=54e7991c0c57a3d379685f60c61660a0110ca0be;p=bacula%2Fbacula Fix rescheduling if files saved git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@585 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/kernstodo b/bacula/kernstodo index 9bd45237ec..579c34b127 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -32,6 +32,8 @@ Testing to do: (painful) - Figure out how to use ssh or stunnel to protect Bacula communications. For 1.31 release: +- Grep for Backup OK in regression script. +- Do NOT reuse same JobId if tape written. - Move JobFiles and JobBytes to SD rather than FD -- more correct. - Add client name to cram-md5 challenge so Director can immediately verify if it is the correct client. diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 83ca5d876d..ec28e6e237 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -273,13 +273,34 @@ bail_out: jcr->job->RescheduleTimes > 0 && jcr->reschedule_count < jcr->job->RescheduleTimes) { + /* + * Reschedule this job by cleaning it up, but + * reuse the same JobId if possible. + */ jcr->reschedule_count++; jcr->sched_time = time(NULL) + jcr->job->RescheduleInterval; Dmsg2(000, "Reschedule Job %s in %d seconds.\n", jcr->Job, (int)jcr->job->RescheduleInterval); jcr->JobStatus = JS_Created; /* force new status */ dird_free_jcr(jcr); /* partial cleanup old stuff */ - continue; /* reschedule the job */ + if (jcr->JobBytes == 0) { + continue; /* reschedule the job */ + } + /* + * Something was actually backed up, so we cannot reuse + * the old JobId or there will be database record + * conflicts. We now create a new job, copying the + * appropriate fields. + */ + JCR *njcr = new_jcr(sizeof(JCR), dird_free_jcr); + set_jcr_defaults(njcr, jcr->job); + njcr->reschedule_count = jcr->reschedule_count; + njcr->JobLevel = jcr->JobLevel; + njcr->JobStatus = jcr->JobStatus; + njcr->pool = jcr->pool; + njcr->store = jcr->store; + njcr->messages = jcr->messages; + run_job(njcr); } break; }