]> git.sur5r.net Git - bacula/bacula/commitdiff
Jobq.c race bug fixed + minor updates
authorKern Sibbald <kern@sibbald.com>
Sun, 18 Apr 2004 09:56:51 +0000 (09:56 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 18 Apr 2004 09:56:51 +0000 (09:56 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1233 91ce42f0-d328-0410-95d8-f526ca767f89

13 files changed:
bacula/ReleaseNotes
bacula/kernstodo
bacula/src/Makefile.in
bacula/src/console/console.c
bacula/src/count-lines
bacula/src/dird/backup.c
bacula/src/dird/dird.c
bacula/src/dird/jobq.c
bacula/src/dird/restore.c
bacula/src/filed/filed.c
bacula/src/stored/stored.c
bacula/src/version.h
bacula/src/wx-console/Makefile.in

index c31ddf8c7f3c9a907c0dc4965404da0e90dd94b5..e3df3e177193212852172a7d3977170f9b9f3cda 100644 (file)
@@ -1,12 +1,19 @@
 
           Release Notes for Bacula 1.34.1
 
-  Bacula code: Total files = 306 Total lines = 91,155 (*.h *.c *.in)
+  Bacula code: Total files = 343 Total lines = 98,503 (*.h *.c *.in)
 
 Changes for 1.34.1:  
 - Autochanger users, please note you must add %d to the end of the
   changer command line in your Device resource in your bacula-sd.conf
   file.
+- Fixed a major race condition in the job scheduler when multiple
+  simultaneous jobs is enabled. This occurred only when on job had
+  blocked another because of resource usage.
+- Changed the backup report to indicate "Backup OK -- with warnings
+  if any warning messages were generated.
+- Change output of restore report to indicate:
+  "Restore OK -- warning file count mismatch"
 - Make backup report say "Backup OK with warnings" if either FD or SD
   report any non-fatal errors.
 - Modify bscan to print some elementary statistics (#Jobs, #Files, ...)
index 78d649fbc7d676ec4daa60ab24d36b9e52df46d8..81bafc88133884b7af81c963e2e8e73dc3bcf0ac 100644 (file)
@@ -42,6 +42,8 @@ For 1.33 Testing/Documentation:
 - Add multiple-media-types.txt
 - look at mxt-changer.html
 
+- Why is Files Expected zero on restore from tape?
+
 For version 1.35:
 - Finish SIGHUP work.
 - Check that all change in wait status in the SD are        
index c13964aea404cd99862fde29a9d25e9f0a445b0b..b04ca9c4475f53241dec9dcd7acbc9ed05dad5f5 100644 (file)
@@ -42,6 +42,7 @@ clean:
        @$(RMF) core core.* a.out *.o *.bak *~ *.intpro *.extpro 1 2 3
        @$(RMF) AUTHORS ChangeLog Makefile.am NEWS README acconfig.h autogen.sh 
        @$(RMF) configure.in stamp.h
+       @$(RMF) -r po
        (cd gnome-console; $(MAKE) clean)
        (cd gnome2-console; $(MAKE) clean)
 
index 93802e85561fb0a665f6c9fdd0fb7918bd6bd91a..f88f80ce8afd4fb568f656de55e65fa7acd763c1 100644 (file)
@@ -294,7 +294,7 @@ int main(int argc, char *argv[])
 
    init_stack_dump();
    my_name_is(argc, argv, "bconsole");
-   textdomain("bacula-console");
+   textdomain("bacula");
    init_msg(NULL, NULL);
    working_directory = "/tmp";
    args = get_pool_memory(PM_FNAME);
index 0afd52dd4ea1e4f5f52e9888b6cf6407fe53fa5b..cd70669b770b84fb83684a0aa51f46ff2bd4ee8e 100755 (executable)
@@ -1,7 +1,8 @@
 #!/bin/sh
 rm -f 1
 touch 1
-for i in . console gnome-console cats dird filed filed/win32 win32 findlib lib stored tools; do
+for i in . console gnome-console cats dird filed filed/win32 \
+     win32 win32/compat findlib lib wx-console stored tools; do
   ls -1 $i/*.c $i/*.cpp $i/*.h $i/*.in 2>/dev/null >>1
 done
 cat 1 | $HOME/bin/lines
index 16f75993a0334b36e2142effaded0fbce1f2af6e..1475413f38fe9e71253eb0120068112b9b820268 100644 (file)
@@ -396,7 +396,7 @@ static void backup_cleanup(JCR *jcr, int TermCode, char *since, FILESET_DBR *fsr
    switch (jcr->JobStatus) {
       case JS_Terminated:
         if (jcr->Errors || jcr->SDErrors) {
-            term_msg = _("Backup OK with warnings");
+            term_msg = _("Backup OK -- with warnings");
         } else {
             term_msg = _("Backup OK");
         }
index 71f4bc538d3ba5d7f1ffd764c0f50d26e1aa382d..4274683567e5f159e6eae8de983049d5364cd786 100644 (file)
@@ -105,7 +105,7 @@ int main (int argc, char *argv[])
 
    init_stack_dump();
    my_name_is(argc, argv, "bacula-dir");
-   textdomain("bacula-dir");
+   textdomain("bacula");
    init_msg(NULL, NULL);             /* initialize message handler */
    init_reload();
    daemon_start_time = time(NULL);
index ebedc4a1f28de469f3a51ff7c2aa35e02878fbea..a372e720de0bb27e081c2d7289008a3c0e4b5807 100755 (executable)
@@ -358,7 +358,7 @@ static void *jobq_server(void *arg)
    jobq_t *jq = (jobq_t *)arg;
    jobq_item_t *je;                  /* job entry in queue */
    int stat;
-   bool timedout;
+   bool timedout = false;
    bool work = true;
 
    Dmsg0(300, "Start jobq_server\n");
@@ -373,30 +373,31 @@ static void *jobq_server(void *arg)
       struct timezone tz;
 
       Dmsg0(300, "Top of for loop\n");
-      timedout = false;
-      gettimeofday(&tv, &tz);
-      timeout.tv_nsec = 0;
-      timeout.tv_sec = tv.tv_sec + 4;
-
-      while (!work && !jq->quit) {
-        /*
-         * Wait 4 seconds, then if no more work, exit
-         */
-         Dmsg0(300, "pthread_cond_timedwait()\n");
-        stat = pthread_cond_timedwait(&jq->work, &jq->mutex, &timeout);
-        if (stat == ETIMEDOUT) {
-            Dmsg0(300, "timedwait timedout.\n");
-           timedout = true;
+      if (!work && !jq->quit) {
+        gettimeofday(&tv, &tz);
+        timeout.tv_nsec = 0;
+        timeout.tv_sec = tv.tv_sec + 4;
+
+        while (!jq->quit) {
+           /*
+            * Wait 4 seconds, then if no more work, exit
+            */
+            Dmsg0(300, "pthread_cond_timedwait()\n");
+           stat = pthread_cond_timedwait(&jq->work, &jq->mutex, &timeout);
+           if (stat == ETIMEDOUT) {
+               Dmsg0(300, "timedwait timedout.\n");
+              timedout = true;
+              break;
+           } else if (stat != 0) {
+               /* This shouldn't happen */
+               Dmsg0(300, "This shouldn't happen\n");
+              jq->num_workers--;
+              pthread_mutex_unlock(&jq->mutex);
+              return NULL;
+           }
            break;
-        } else if (stat != 0) {
-            /* This shouldn't happen */
-            Dmsg0(300, "This shouldn't happen\n");
-           jq->num_workers--;
-           pthread_mutex_unlock(&jq->mutex);
-           return NULL;
-        }
-        break;
-      } 
+        } 
+      }
       /* 
        * If anything is in the ready queue, run it
        */
@@ -588,7 +589,20 @@ static void *jobq_server(void *arg)
         jq->num_workers--;
         break;
       }
-      work = !jq->ready_jobs->empty() || !jq->waiting_jobs->empty();              
+      work = !jq->ready_jobs->empty() || !jq->waiting_jobs->empty();
+      if (work) {
+        /*          
+          * If a job is waiting on a Resource, don't consume all
+         *   the CPU time looping looking for work, and even more
+         *   important, release the lock so that a job that has
+         *   terminated can give us the resource.
+         */
+        pthread_mutex_unlock(&jq->mutex);
+        bmicrosleep(2, 0);              /* pause for 2 seconds */
+        pthread_mutex_unlock(&jq->mutex);
+        /* Recompute work as something may have changed in last 2 secs */
+        work = !jq->ready_jobs->empty() || !jq->waiting_jobs->empty();
+      }
       Dmsg1(300, "Loop again. work=%d\n", work);
    } /* end of big for loop */
 
index 5dc2398f129164eb660b4d9819efb3d6e9b604c8..082877a878c6f66274a4205329058e65094feeda 100644 (file)
@@ -279,7 +279,11 @@ static void restore_cleanup(JCR *jcr, int TermCode)
    msg_type = M_INFO;                /* by default INFO message */
    switch (TermCode) {
    case JS_Terminated:
-      term_msg = _("Restore OK");
+      if (jcr->ExpectedFiles > jcr->jr.JobFiles) {
+         term_msg = _("Restore OK -- warning file count mismatch");
+      } else {
+         term_msg = _("Restore OK");
+      }
       break;
    case JS_FatalError:
    case JS_ErrorTerminated:
index 5ebf0c37ba0360296a1409b3d399bdeb1cb65f30..adf7c3364fcdb30ac7ce83efc554ff3dcfb7cf31 100644 (file)
@@ -97,7 +97,7 @@ int main (int argc, char *argv[])
 
    init_stack_dump();
    my_name_is(argc, argv, "bacula-fd");
-   textdomain("bacula-fd");
+   textdomain("bacula");
    init_msg(NULL, NULL);
    daemon_start_time = time(NULL);
 
index 746f3831ae934ef43b3e5f2160fbae85c081d55b..f910f85e2fefb28c28cdf28ffd80b33a1bd22079 100644 (file)
@@ -94,7 +94,7 @@ int main (int argc, char *argv[])
 
    init_stack_dump();
    my_name_is(argc, argv, "bacula-sd");
-   textdomain("bacula-sd");
+   textdomain("bacula");
    init_msg(NULL, NULL);
    daemon_start_time = time(NULL);
 
index b5e80cb33cfa98aefd98b636aa0bf860f5bbe3af..aff083a2bbed4d3593024a1496fc92ef4ca04430 100644 (file)
@@ -2,8 +2,8 @@
 #undef  VERSION
 #define VERSION "1.35.0"
 #define VSTRING "1"
-#define BDATE   "16 Apr 2004"
-#define LSMDATE "16Apr04"
+#define BDATE   "18 Apr 2004"
+#define LSMDATE "18Apr04"
 
 /* Debug flags */
 #undef  DEBUG
index 48f814af84cd048ce569ea7540b98a5c2e33f163..b3e186d4c5b6dd97f7b916629c4bf4d81e60fb6f 100644 (file)
@@ -66,7 +66,7 @@ wx-console_private.res: wx-console_private.rc
        windres.exe -i wx-console_private.rc -I rc -o wx-console_private.res -O coff 
 
 clean:
-       @$(RMF) $(OBJ) wx-console $(WIN32RES)
+       @$(RMF) $(CONSOBJS) wx-console $(WIN32RES)
 
 distclean: clean
        $(RMF) Makefile