From: Eric Bollengier Date: Wed, 29 Oct 2008 08:22:30 +0000 (+0000) Subject: ebl Try to fix maxwaittime to be cumulative X-Git-Tag: Release-3.0.0~679 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3390bb40d91fde890c0a02a62772f764163f2784;p=bacula%2Fbacula ebl Try to fix maxwaittime to be cumulative git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7930 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/patches/testing/fix_maxwaittime.patch b/bacula/patches/testing/fix_maxwaittime.patch new file mode 100644 index 0000000000..502364d547 --- /dev/null +++ b/bacula/patches/testing/fix_maxwaittime.patch @@ -0,0 +1,140 @@ +Index: src/dird/job.c +=================================================================== +--- src/dird/job.c (révision 7929) ++++ src/dird/job.c (copie de travail) +@@ -551,7 +551,7 @@ + } + Dmsg3(200, "check maxwaittime %u - %u >= %u\n", watchdog_time, jcr->wait_time, job->MaxWaitTime); + if (job->MaxWaitTime != 0 && +- (watchdog_time - jcr->wait_time) >= job->MaxWaitTime) { ++ (watchdog_time - jcr->wait_time + jcr->wait_time_sum) >= job->MaxWaitTime) { + cancel = true; + } + +Index: src/jcr.h +=================================================================== +--- src/jcr.h (révision 7929) ++++ src/jcr.h (copie de travail) +@@ -216,7 +216,8 @@ + time_t start_time; /* when job actually started */ + time_t run_time; /* used for computing speed */ + time_t end_time; /* job end time */ +- time_t wait_time; /* when job have started to wait */ ++ time_t wait_time_sum; /* cumulative wait time since job start */ ++ time_t wait_time; /* timestamp when job have started to wait */ + POOLMEM *client_name; /* client name */ + POOLMEM *RestoreBootstrap; /* Bootstrap file to restore */ + POOLMEM *stime; /* start time for incremental/differential */ +Index: src/lib/jcr.c +=================================================================== +--- src/lib/jcr.c (révision 7929) ++++ src/lib/jcr.c (copie de travail) +@@ -738,41 +738,29 @@ + return priority; + } + +-void set_jcr_job_status(JCR *jcr, int JobStatus) ++ ++static void update_wait_time(JCR *jcr, int newJobStatus) + { +- bool set_waittime = false; +- int oldJobStatus = jcr->JobStatus; +- int priority, old_priority; ++ bool enter_in_waittime; ++ int oldJobStatus = jcr->JobStatus; + +- priority = get_status_priority(JobStatus); +- old_priority = get_status_priority(oldJobStatus); +- +- 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. +- */ +- Dmsg3(300, "jid=%u OnEntry JobStatus=%c set=%c\n", (uint32_t)jcr->JobId, +- jcr->JobStatus, JobStatus); +- if (priority >= old_priority) { +- jcr->JobStatus = JobStatus; /* replace with new priority */ ++ switch (newJobStatus) { ++ 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: ++ enter_in_waittime = true; ++ break; ++ default: ++ enter_in_waittime = false; /* not a Wait situation */ ++ break; + } ++ + /* + * If we were previously waiting and are not any more + * we want to update the wait_time variable, which is +@@ -788,13 +776,43 @@ + case JS_WaitClientRes: + case JS_WaitMaxJobs: + case JS_WaitPriority: +- set_waittime = false; /* keep old time */ ++ if (!enter_in_waittime) { ++ jcr->wait_time_sum += (time(NULL) - jcr->wait_time); ++ jcr->wait_time = 0; ++ } ++ break; ++ ++ /* if wait state is new, we keep current time for watchdog MaxWaitTime */ + default: +- if (set_waittime) { +- Dmsg0(800, "Setting wait_time\n"); ++ if (enter_in_waittime) { + jcr->wait_time = time(NULL); + } ++ break; + } ++} ++ ++void set_jcr_job_status(JCR *jcr, int JobStatus) ++{ ++ int priority, old_priority; ++ ++ priority = get_status_priority(JobStatus); ++ old_priority = get_status_priority(oldJobStatus); ++ ++ Dmsg2(800, "set_jcr_job_status(%s, %c)\n", jcr->Job, JobStatus); ++ ++ /* Update wait_time depending on newJobStatus and oldJobStatus */ ++ update_wait_time(jcr, JobStatus); ++ ++ /* ++ * For a set of errors, ... keep the current status ++ * so it isn't lost. For all others, set it. ++ */ ++ Dmsg3(300, "jid=%u OnEntry JobStatus=%c set=%c\n", (uint32_t)jcr->JobId, ++ jcr->JobStatus, JobStatus); ++ if (priority >= old_priority) { ++ jcr->JobStatus = JobStatus; /* replace with new priority */ ++ } ++ + if (oldJobStatus != jcr->JobStatus) { + Dmsg3(200, "jid=%u leave set_old_job_status=%c new_set=%c\n", (uint32_t)jcr->JobId, + oldJobStatus, JobStatus);