]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix rescheduling if files saved
authorKern Sibbald <kern@sibbald.com>
Mon, 16 Jun 2003 22:12:52 +0000 (22:12 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 16 Jun 2003 22:12:52 +0000 (22:12 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@585 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/src/dird/job.c

index 9bd45237ecf0a5e0b39e65b12efd32414d88320a..579c34b1273d2cd523be1401990c93fc15b6a6ef 100644 (file)
@@ -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.
index 83ca5d876d0bbacdf2c7ee7d04dcdc71d9fdd438..ec28e6e2378f9d6cc4f26a5c00c267686ee2452d 100644 (file)
@@ -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;
    }