]> git.sur5r.net Git - bacula/bacula/commitdiff
Put resched Incomplete Job on directive default=on
authorKern Sibbald <kern@sibbald.com>
Mon, 14 Feb 2011 17:23:46 +0000 (18:23 +0100)
committerKern Sibbald <kern@sibbald.com>
Mon, 14 Feb 2011 17:30:31 +0000 (18:30 +0100)
bacula/src/dird/dird_conf.c
bacula/src/dird/dird_conf.h
bacula/src/dird/jobq.c

index f4170d6538931f18c31fd4cb193e8f41e15b9292..96479d0121dd1fd34a3eccb63c620baf1366b66a 100644 (file)
@@ -328,8 +328,9 @@ RES_ITEM job_items[] = {
    {"clientrunafterjob",  store_short_runscript,  ITEM(res_job.RunScripts),  0, 0, 0},
    {"maximumconcurrentjobs", store_pint32, ITEM(res_job.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1},
    {"rescheduleonerror", store_bool, ITEM(res_job.RescheduleOnError), 0, ITEM_DEFAULT, false},
+   {"rescheduleincompletejobs", store_bool, ITEM(res_job.RescheduleIncompleteJobs), 0, ITEM_DEFAULT, true},
    {"rescheduleinterval", store_time, ITEM(res_job.RescheduleInterval), 0, ITEM_DEFAULT, 60 * 30},
-   {"rescheduletimes",    store_pint32, ITEM(res_job.RescheduleTimes), 0, 0, 0},
+   {"rescheduletimes",    store_pint32, ITEM(res_job.RescheduleTimes), 0, 0, 5},
    {"priority",           store_pint32, ITEM(res_job.Priority), 0, ITEM_DEFAULT, 10},
    {"allowmixedpriority", store_bool, ITEM(res_job.allow_mixed_priority), 0, ITEM_DEFAULT, false},
    {"writepartafterjob",  store_bool, ITEM(res_job.write_part_after_job), 0, ITEM_DEFAULT, true},
index 9483f844a45993abe83bee1b455a3a1fd1f36bc4..156dbf2e4b2111a1fd485a90ce43285036701cf5 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2011 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -422,6 +422,7 @@ public:
 
    bool where_use_regexp;             /* true if RestoreWhere is a BREGEXP */
    bool RescheduleOnError;            /* Set to reschedule on error */
+   bool RescheduleIncompleteJobs;     /* Set to reschedule incomplete Jobs */
    bool PrefixLinks;                  /* prefix soft links with Where path */
    bool PruneJobs;                    /* Force pruning of Jobs */
    bool PruneFiles;                   /* Force pruning of Files */
index c9d055e5e24b0f6f796d7f3ce369646126b6bf7a..97917b676b79c4d7f782316d6c76851e8792faa3 100644 (file)
@@ -612,15 +612,23 @@ void *jobq_server(void *arg)
  */
 static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je)
 {
+   bool resched = false;
    /*
-    * Reschedule the job if necessary and requested
+    * Reschedule the job if requested and possible
     */
-   if (jcr->job->RescheduleOnError &&
-       jcr->JobStatus != JS_Terminated &&
-       jcr->JobStatus != JS_Canceled &&
-       jcr->getJobType() == JT_BACKUP &&
-       (jcr->job->RescheduleTimes == 0 ||
-        jcr->reschedule_count < jcr->job->RescheduleTimes)) {
+   /* Basic condition is that more times remain */
+   if (jcr->job->RescheduleTimes == 0 ||
+       jcr->reschedule_count < jcr->job->RescheduleTimes) {
+      resched = 
+         /* Check for incomplete jobs */
+         (jcr->job->RescheduleIncompleteJobs && jcr->is_incomplete()) ||
+         /* Check for failed jobs */
+         (jcr->job->RescheduleOnError &&
+          jcr->JobStatus != JS_Terminated &&
+          jcr->JobStatus != JS_Canceled &&
+          jcr->getJobType() == JT_BACKUP);
+   }
+   if (resched) {
        char dt[50], dt2[50];
 
        /*
@@ -645,6 +653,7 @@ static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je)
       if (!allow_duplicate_job(jcr)) {
          return false;
       }
+      /* Only jobs with no output or Incomplete jobs can run on same JCR */
       if (jcr->JobBytes == 0 || jcr->incomplete) {
          Dmsg2(2300, "Requeue job=%d use=%d\n", jcr->JobId, jcr->use_count());
          V(jq->mutex);