From: Kern Sibbald Date: Mon, 14 Feb 2011 17:23:46 +0000 (+0100) Subject: Put resched Incomplete Job on directive default=on X-Git-Tag: Release-7.0.0~1131 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9a655a0840fc6833b3b39278106921ed8c15585c;p=bacula%2Fbacula Put resched Incomplete Job on directive default=on --- diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 08186d18ea..3459351804 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -326,8 +326,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}, diff --git a/bacula/src/dird/dird_conf.h b/bacula/src/dird/dird_conf.h index d036f5914a..73a17fb874 100644 --- a/bacula/src/dird/dird_conf.h +++ b/bacula/src/dird/dird_conf.h @@ -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. @@ -421,6 +421,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 */ diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index c9d055e5e2..97917b676b 100644 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -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);