[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bacula-devel] Concurrency and priority


Kjetil Torgrim Homme <kjetilho@xxxxxxxxx> writes:

> This leads to my proposal: make the priority override option an
> attribute for each Job.  This way an installation can turn it on
> via JobDefs, and turn it off for the Catalog backup.  The attached
> patch adds the keyword AllowMixedPriority (default false) to the Job
> resource.

The patch was slightly wrong, it didn't check the setting for the job
under consideration for being run.  Please use this patch instead.
FWIW, we are running this in production applied to 2.4.0 (you'll get a
small reject due to store_pint being changed to store_pint32 in
trunk).

--
thanks,
Kjetil T. Homme
Linpro AS

Index: src/dird/dird_conf.c
===================================================================
--- src/dird/dird_conf.c	(revision 7277)
+++ src/dird/dird_conf.c	(working copy)
@@ -325,6 +325,7 @@
    {"rescheduleinterval", store_time, ITEM(res_job.RescheduleInterval), 0, ITEM_DEFAULT, 60 * 30},
    {"rescheduletimes",    store_pint32, ITEM(res_job.RescheduleTimes), 0, 0, 0},
    {"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},
    {"selectionpattern",   store_str, ITEM(res_job.selection_pattern), 0, 0, 0},
    {"runscript",          store_runscript, ITEM(res_job.RunScripts), 0, ITEM_NO_EQUALS, 0},
Index: src/dird/jobq.c
===================================================================
--- src/dird/jobq.c	(revision 7277)
+++ src/dird/jobq.c	(working copy)
@@ -504,11 +504,22 @@
       Dmsg0(2300, "Done check ready, now check wait queue.\n");
       if (!jq->waiting_jobs->empty() && !jq->quit) {
          int Priority;
+         bool running_allow_mix = false;
          je = (jobq_item_t *)jq->waiting_jobs->first();
          jobq_item_t *re = (jobq_item_t *)jq->running_jobs->first();
          if (re) {
             Priority = re->jcr->JobPriority;
             Dmsg2(2300, "JobId %d is running. Look for pri=%d\n", re->jcr->JobId, Priority);
+	    running_allow_mix = true;
+	    for ( ; re;  ) {
+	       if (!re->jcr->job->allow_mixed_priority) {
+		  running_allow_mix = false;
+		  break;
+	       }
+	       re = (jobq_item_t *)jq->running_jobs->next(re);
+	    }
+            Dmsg1(2300, "The running job(s) %s mixing priorities.\n",
+		  running_allow_mix ? "allow" : "don't allow");
          } else {
             Priority = je->jcr->JobPriority;
             Dmsg1(2300, "No job running. Look for Job pri=%d\n", Priority);
@@ -526,7 +537,9 @@
                jcr->JobId, jcr->JobPriority, Priority);
 
             /* Take only jobs of correct Priority */
-            if (jcr->JobPriority != Priority) {
+            if (!(jcr->JobPriority == Priority
+		  || (jcr->JobPriority < Priority &&
+		      jcr->job->allow_mixed_priority && running_allow_mix))) {
                set_jcr_job_status(jcr, JS_WaitPriority);
                break;
             }
Index: src/dird/dird_conf.h
===================================================================
--- src/dird/dird_conf.h	(revision 7277)
+++ src/dird/dird_conf.h	(working copy)
@@ -397,6 +397,7 @@
    int64_t spool_size;                /* Size of spool file for this job */
    uint32_t MaxConcurrentJobs;        /* Maximum concurrent jobs */
    uint32_t NumConcurrentJobs;        /* number of concurrent jobs running */
+   bool allow_mixed_priority;         /* Allow jobs with higher priority concurrently with this */
 
    MSGS      *messages;               /* How and where to send messages */
    SCHED     *schedule;               /* When -- Automatic schedule */
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Bacula-devel mailing list
Bacula-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bacula-devel


This mailing list archive is a service of Copilotco.