From: Eric Bollengier Date: Wed, 9 Jul 2008 09:02:54 +0000 (+0000) Subject: ebl Update MaxWaitTime and MaxRunSchedTime patch X-Git-Tag: Release-2.4.2~38 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1b498e36a6104305e6f2368c89f19d823b58357d;p=bacula%2Fbacula ebl Update MaxWaitTime and MaxRunSchedTime patch git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.4@7347 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/patches/testing/maxschedruntime.patch b/bacula/patches/testing/maxschedruntime.patch index 1c122a4aea..af44396af6 100644 --- a/bacula/patches/testing/maxschedruntime.patch +++ b/bacula/patches/testing/maxschedruntime.patch @@ -1,6 +1,6 @@ Index: src/dird/getmsg.c =================================================================== ---- src/dird/getmsg.c (révision 4696) +--- src/dird/getmsg.c (révision 7346) +++ src/dird/getmsg.c (copie de travail) @@ -70,6 +70,33 @@ @@ -47,7 +47,7 @@ Index: src/dird/getmsg.c } Index: src/dird/job.c =================================================================== ---- src/dird/job.c (révision 4696) +--- src/dird/job.c (révision 7346) +++ src/dird/job.c (copie de travail) @@ -41,8 +41,9 @@ static void *job_thread(void *arg); @@ -61,7 +61,7 @@ Index: src/dird/job.c /* Imported subroutines */ extern void term_scheduler(); -@@ -250,6 +251,11 @@ +@@ -251,6 +252,11 @@ Jmsg(jcr, M_FATAL, 0, _("Job canceled because max start delay time exceeded.\n")); } @@ -73,30 +73,29 @@ Index: src/dird/job.c /* TODO : check if it is used somewhere */ if (jcr->job->RunScripts == NULL) { Dmsg0(200, "Warning, job->RunScripts is empty\n"); -@@ -450,15 +456,20 @@ +@@ -492,15 +498,19 @@ } /* check MaxWaitTime */ - if (job_check_maxwaittime(control_jcr, jcr)) { + if (job_check_maxwaittime(jcr)) { set_jcr_job_status(jcr, JS_Canceled); - Jmsg(jcr, M_FATAL, 0, _("Max wait time exceeded. Job canceled.\n")); + Qmsg(jcr, M_FATAL, 0, _("Max wait time exceeded. Job canceled.\n")); cancel = true; /* check MaxRunTime */ - } else if (job_check_maxruntime(control_jcr, jcr)) { + } else if (job_check_maxruntime(jcr)) { set_jcr_job_status(jcr, JS_Canceled); - Jmsg(jcr, M_FATAL, 0, _("Max run time exceeded. Job canceled.\n")); + Qmsg(jcr, M_FATAL, 0, _("Max run time exceeded. Job canceled.\n")); cancel = true; -+ /* check MaxSchedRunTime */ + } else if (job_check_maxschedruntime(jcr)) { + set_jcr_job_status(jcr, JS_Canceled); -+ Jmsg(jcr, M_FATAL, 0, _("Max sched run time exceeded. Job canceled.\n")); ++ Qmsg(jcr, M_FATAL, 0, _("Max sched run time exceeded. Job canceled.\n")); + cancel = true; } if (cancel) { -@@ -479,29 +490,30 @@ +@@ -521,29 +531,30 @@ * Check if the maxwaittime has expired and it is possible * to cancel the job. */ @@ -134,16 +133,16 @@ Index: src/dird/job.c cancel = true; } -@@ -512,7 +524,7 @@ +@@ -554,7 +565,7 @@ * Check if maxruntime has expired and if the job can be * canceled. */ -static bool job_check_maxruntime(JCR *control_jcr, JCR *jcr) +static bool job_check_maxruntime(JCR *jcr) { - if (jcr->job->MaxRunTime == 0 || job_canceled(jcr)) { + if (jcr->job->MaxRunTime == 0 || job_canceled(jcr) || jcr->JobStatus == JS_Created) { return false; -@@ -527,6 +539,24 @@ +@@ -569,6 +580,24 @@ } /* @@ -170,9 +169,9 @@ Index: src/dird/job.c * poolid if OK Index: src/dird/dird_conf.c =================================================================== ---- src/dird/dird_conf.c (révision 4696) +--- src/dird/dird_conf.c (révision 7346) +++ src/dird/dird_conf.c (copie de travail) -@@ -281,6 +281,7 @@ +@@ -282,6 +282,7 @@ {"writebootstrap",store_dir, ITEM(res_job.WriteBootstrap), 0, 0, 0}, {"writeverifylist",store_dir, ITEM(res_job.WriteVerifyList), 0, 0, 0}, {"replace", store_replace, ITEM(res_job.replace), 0, ITEM_DEFAULT, REPLACE_ALWAYS}, @@ -180,7 +179,7 @@ Index: src/dird/dird_conf.c {"maxruntime", store_time, ITEM(res_job.MaxRunTime), 0, 0, 0}, {"fullmaxwaittime", store_time, ITEM(res_job.FullMaxWaitTime), 0, 0, 0}, {"incrementalmaxwaittime", store_time, ITEM(res_job.IncMaxWaitTime), 0, 0, 0}, -@@ -627,6 +628,15 @@ +@@ -634,6 +639,15 @@ if (res->res_job.WriteBootstrap) { sendit(sock, _(" --> WriteBootstrap=%s\n"), NPRT(res->res_job.WriteBootstrap)); } @@ -198,21 +197,21 @@ Index: src/dird/dird_conf.c foreach_alist(store, res->res_job.storage) { Index: src/dird/dird_conf.h =================================================================== ---- src/dird/dird_conf.h (révision 4696) +--- src/dird/dird_conf.h (révision 7346) +++ src/dird/dird_conf.h (copie de travail) @@ -371,6 +371,7 @@ char *WriteVerifyList; /* List of changed files */ }; - int replace; /* How (overwrite, ..) */ + uint32_t replace; /* How (overwrite, ..) */ + utime_t MaxSchedRunTime; /* max run time in seconds from Scheduled time*/ utime_t MaxRunTime; /* max run time in seconds */ utime_t MaxWaitTime; /* max blocking time in seconds */ utime_t FullMaxWaitTime; /* Max Full job wait time */ Index: src/jcr.h =================================================================== ---- src/jcr.h (révision 4696) +--- src/jcr.h (révision 7346) +++ src/jcr.h (copie de travail) -@@ -105,6 +105,22 @@ +@@ -107,6 +107,22 @@ jcr->JobStatus == JS_ErrorTerminated || \ jcr->JobStatus == JS_FatalError) @@ -235,7 +234,7 @@ Index: src/jcr.h #define foreach_jcr(jcr) \ for (jcr=jcr_walk_start(); jcr; (jcr=jcr_walk_next(jcr)) ) -@@ -166,6 +182,7 @@ +@@ -168,6 +184,7 @@ time_t start_time; /* when job actually started */ time_t run_time; /* used for computing speed */ time_t end_time; /* job end time */ @@ -245,42 +244,41 @@ Index: src/jcr.h POOLMEM *stime; /* start time for incremental/differential */ Index: src/lib/jcr.c =================================================================== ---- src/lib/jcr.c (révision 4696) +--- src/lib/jcr.c (révision 7346) +++ src/lib/jcr.c (copie de travail) -@@ -546,18 +546,54 @@ +@@ -596,6 +596,24 @@ void set_jcr_job_status(JCR *jcr, int JobStatus) { -+ bool set_waittime=false; -+ Dmsg2(800, "set_jcr_job_status(%s, %c)\n", jcr->Job, JobStatus); -+ /* if wait state is new, we keep current time for watchdog MaxWaitTime */ -+ switch (JobStatus) { -+ case JS_WaitFD: -+ case JS_WaitSD: -+ case JS_WaitMedia: -+ case JS_WaitMount: -+ case JS_WaitStoreRes: -+ case JS_WaitJobRes: -+ case JS_WaitClientRes: -+ case JS_WaitMaxJobs: -+ case JS_WaitPriority: -+ set_waittime = true; -+ default: -+ break; -+ } -+ -+ switch (jcr->JobStatus) { ++ bool set_waittime=false; ++ Dmsg2(800, "set_jcr_job_status(%s, %c)\n", jcr->Job, JobStatus); ++ /* if wait state is new, we keep current time for watchdog MaxWaitTime */ ++ switch (JobStatus) { ++ case JS_WaitFD: ++ case JS_WaitSD: ++ case JS_WaitMedia: ++ case JS_WaitMount: ++ case JS_WaitStoreRes: ++ case JS_WaitJobRes: ++ case JS_WaitClientRes: ++ case JS_WaitMaxJobs: ++ case JS_WaitPriority: ++ set_waittime = true; ++ default: ++ break; ++ } ++ /* * For a set of errors, ... keep the current status * so it isn't lost. For all others, set it. - */ -- switch (jcr->JobStatus) { - case JS_ErrorTerminated: - case JS_Error: - case JS_FatalError: - case JS_Differences: - case JS_Canceled: - break; +@@ -615,10 +633,29 @@ + /* Override more minor status */ + jcr->JobStatus = JobStatus; + break; ++ default: ++ break; + } +- break; + /* + * For a set of Wait situation, keep old time. + */ @@ -292,14 +290,15 @@ Index: src/lib/jcr.c + case JS_WaitJobRes: + case JS_WaitClientRes: + case JS_WaitMaxJobs: -+ case JS_WaitPriority: -+ set_waittime = false; /* keep old time */ ++ case JS_WaitPriority: ++ set_waittime = false; /* keep old time */ default: + jcr->JobStatus = JobStatus; + if (set_waittime) { -+ /* set it before JobStatus */ -+ Dmsg0(800, "Setting wait_time\n"); -+ jcr->wait_time = time(NULL); ++ /* set it before JobStatus */ ++ Dmsg0(800, "Setting wait_time\n"); ++ jcr->wait_time = time(NULL); + } - jcr->JobStatus = JobStatus; } + Dmsg2(200, "OnExit JobStatus=%c set=%c\n", jcr->JobStatus, JobStatus); }