]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix bug #1268 Full Max Run Time cancels jobs (when Max Run Time = 0).
authorKern Sibbald <kern@sibbald.com>
Tue, 14 Apr 2009 12:44:53 +0000 (12:44 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 14 Apr 2009 12:44:53 +0000 (12:44 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8728 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/Patchnotes
bacula/patches/3.0.0-maxruntime.patch [new file with mode: 0644]
bacula/src/dird/job.c
bacula/technotes

index 304387cdf78ca26dcbea6bd8137c15fd5db01fc8..76ea7bb5ca4c23f940c3a320aa9e193d1cc811d0 100644 (file)
@@ -2,4 +2,7 @@
 
 
 Patches Committed:
+14Apr09
+3.0.0-maxruntime.patch
+11Apr09
 3.0.0-read-vol-list.patch
diff --git a/bacula/patches/3.0.0-maxruntime.patch b/bacula/patches/3.0.0-maxruntime.patch
new file mode 100644 (file)
index 0000000..f232eb3
--- /dev/null
@@ -0,0 +1,59 @@
+
+ This patch can be applied to version 3.0.0. It fixes bug #1268 
+ Full Max Run TIme cancels jobs (when Max Run Time = 0).
+
+ Apply it to version 3.0.0 with:
+
+ cd <bacula-source>
+ patch -p0 <3.0.0-read-vol-list.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+
+Index: src/dird/job.c
+===================================================================
+--- src/dird/job.c     (revision 8699)
++++ src/dird/job.c     (working copy)
+@@ -578,6 +578,7 @@
+ {
+    bool cancel = false;
+    JOB *job = jcr->job;
++   utime_t run_time;
+    if (job_canceled(jcr) || jcr->JobStatus == JS_Created) {
+       return false;
+@@ -586,20 +587,25 @@
+        job->IncMaxRunTime == 0 && job->DiffMaxRunTime == 0) {
+       return false;
+    }
+-   Dmsg6(200, "check_maxruntime %u - %u >= %u|%u|%u|%u\n\n",
+-         watchdog_time, jcr->start_time, job->MaxRunTime, job->FullMaxRunTime, 
++   run_time = watchdog_time - jcr->start_time;
++   Dmsg7(200, "check_maxruntime %llu-%u=%llu >= %llu|%llu|%llu|%llu\n",
++         watchdog_time, jcr->start_time, run_time, job->MaxRunTime, job->FullMaxRunTime, 
+          job->IncMaxRunTime, job->DiffMaxRunTime);
+    if (jcr->get_JobLevel() == L_FULL && job->FullMaxRunTime != 0 &&
+-         (watchdog_time - jcr->start_time) >= job->FullMaxRunTime) {
++         run_time >= job->FullMaxRunTime) {
++      Dmsg0(200, "check_maxwaittime: FullMaxcancel\n");
+       cancel = true;
+    } else if (jcr->get_JobLevel() == L_DIFFERENTIAL && job->DiffMaxRunTime != 0 &&
+-         (watchdog_time - jcr->start_time) >= job->DiffMaxRunTime) {
++         run_time >= job->DiffMaxRunTime) {
++      Dmsg0(200, "check_maxwaittime: DiffMaxcancel\n");
+       cancel = true;
+    } else if (jcr->get_JobLevel() == L_INCREMENTAL && job->IncMaxRunTime != 0 &&
+-         (watchdog_time - jcr->start_time) >= job->IncMaxRunTime) {
++         run_time >= job->IncMaxRunTime) {
++      Dmsg0(200, "check_maxwaittime: IncMaxcancel\n");
+       cancel = true;
+-   } else if ((watchdog_time - jcr->start_time) >= job->MaxRunTime) {
++   } else if (job->MaxRunTime > 0 && run_time >= job->MaxRunTime) {
++      Dmsg0(200, "check_maxwaittime: Maxcancel\n");
+       cancel = true;
+    }
+  
index 4329a76f2e7a072d030ad1d0b9ed083f3757fdf5..252a89a8651692c35c91dddb0490e0dd2ec4e0a7 100644 (file)
@@ -578,6 +578,7 @@ static bool job_check_maxruntime(JCR *jcr)
 {
    bool cancel = false;
    JOB *job = jcr->job;
+   utime_t run_time;
 
    if (job_canceled(jcr) || jcr->JobStatus == JS_Created) {
       return false;
@@ -586,20 +587,25 @@ static bool job_check_maxruntime(JCR *jcr)
        job->IncMaxRunTime == 0 && job->DiffMaxRunTime == 0) {
       return false;
    }
-   Dmsg6(200, "check_maxruntime %u - %u >= %u|%u|%u|%u\n\n",
-         watchdog_time, jcr->start_time, job->MaxRunTime, job->FullMaxRunTime, 
+   run_time = watchdog_time - jcr->start_time;
+   Dmsg7(200, "check_maxruntime %llu-%u=%llu >= %llu|%llu|%llu|%llu\n",
+         watchdog_time, jcr->start_time, run_time, job->MaxRunTime, job->FullMaxRunTime, 
          job->IncMaxRunTime, job->DiffMaxRunTime);
 
    if (jcr->get_JobLevel() == L_FULL && job->FullMaxRunTime != 0 &&
-         (watchdog_time - jcr->start_time) >= job->FullMaxRunTime) {
+         run_time >= job->FullMaxRunTime) {
+      Dmsg0(200, "check_maxwaittime: FullMaxcancel\n");
       cancel = true;
    } else if (jcr->get_JobLevel() == L_DIFFERENTIAL && job->DiffMaxRunTime != 0 &&
-         (watchdog_time - jcr->start_time) >= job->DiffMaxRunTime) {
+         run_time >= job->DiffMaxRunTime) {
+      Dmsg0(200, "check_maxwaittime: DiffMaxcancel\n");
       cancel = true;
    } else if (jcr->get_JobLevel() == L_INCREMENTAL && job->IncMaxRunTime != 0 &&
-         (watchdog_time - jcr->start_time) >= job->IncMaxRunTime) {
+         run_time >= job->IncMaxRunTime) {
+      Dmsg0(200, "check_maxwaittime: IncMaxcancel\n");
       cancel = true;
-   } else if ((watchdog_time - jcr->start_time) >= job->MaxRunTime) {
+   } else if (job->MaxRunTime > 0 && run_time >= job->MaxRunTime) {
+      Dmsg0(200, "check_maxwaittime: Maxcancel\n");
       cancel = true;
    }
  
index c6a118c0ce90a6838a27e7257750a8a22d4f2813..3334291aed0aa1b31d10d935a07fbe999413638b 100644 (file)
@@ -2,6 +2,8 @@
           
 General:
 
+14Apr09
+kes  Fix bug #1268 Full Max Run Time cancels jobs (when Max Run Time = 0).
 11Apr09
 kes  Modify insertion of read Volumes in SD to be done before the
      drive reservation. This ensures that a Volume to be read will not