]> git.sur5r.net Git - bacula/bacula/commitdiff
- Make reservation system single threaded during the
authorKern Sibbald <kern@sibbald.com>
Thu, 4 Aug 2005 08:49:00 +0000 (08:49 +0000)
committerKern Sibbald <kern@sibbald.com>
Thu, 4 Aug 2005 08:49:00 +0000 (08:49 +0000)
  search to avoid two threads competing for the same
  resource.
- Correct a return code in find_suitable_device_for_job()
  Possibly cause of busy writing to another volume.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2291 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/kes-1.37
bacula/src/stored/acquire.c
bacula/src/stored/reserve.c
bacula/src/stored/wait.c
bacula/src/version.h

index b8da8d6a10a0ef6ffd8c5b17ab62c025075e4833..d31a541110849dc062cfe68a34577c9678c0ab45 100644 (file)
@@ -1,5 +1,5 @@
                     Kern's ToDo List
-                     24 July 2005
+                     04 August 2005
 
 Major development:      
 Project                     Developer
@@ -10,11 +10,8 @@ Version 1.37                Kern (see below)
 Final items for 1.37 before release:
 1. Fix bugs
 - Tape xxx in drive 0, requested in drive 1
-- Multi-drive changer seems to only use drive 0
-  Multiple drives don't seem to be opened.
-- Why isn't the DEVICE structure defined when doing
-  a reservation?
 - The mount command does not work with drives other than 0.
+- Look at fixing restore status stats in SD.
 
 -  --without-openssl breaks at least on Solaris.
 9. Run the regression scripts on Solaris and FreeBSD
@@ -23,7 +20,6 @@ Final items for 1.37 before release:
 -  Arno had to do -- to get update slots=x to work
    UPDATE Media SET InChanger=0,Slot=0 WHERE InChanger>0 AND Slot>0; (MySQL)
 
-
 Document:
 - Document cleaning up the spool files:
   db, pid, state, bsr, mail, conmsg, spool
@@ -1437,3 +1433,8 @@ Block Position: 0
 - Add better documentation on how restores can be done
 8. Take one more try at making DVD writing work (no go)
 7. Write a bacula-web document
+- Why isn't the DEVICE structure defined when doing
+  a reservation?
+- Multi-drive changer seems to only use drive 0
+  Multiple drives don't seem to be opened.
+
index ba38515cca67eb0cd2985883c86db6f77ace4971..a047660cf3b419b840029a5ab11189534138e157 100644 (file)
@@ -4,6 +4,12 @@
 General:
 
 Changes to 1.37.34:
+04Aug03
+- Make reservation system single threaded during the
+  search to avoid two threads competing for the same
+  resource.
+- Correct a return code in find_suitable_device_for_job()
+  Possibly cause of "busy writing to another volume".
 03Aug03
 - Modify open() for tape so nonblocking really works.  
 - Use fcntl() to reset blocking status rather than close()
index 6e82b61dbf0a4e4ff1fb16f28336101e9abaf964..f0ceb6d6a5d8e5fcc6fc41ce65f36dd20b074d18 100644 (file)
@@ -354,7 +354,7 @@ DCR *acquire_device_for_append(DCR *dcr)
             free_unused_volume(dcr);
          }
          if (dev->num_writers != 0 || dev->reserved_device) {
-            Jmsg(jcr, M_FATAL, 0, _("Wanted Volume \"%s\", but device %s is busy writing on \"%s\" .\n"), 
+            Jmsg3(jcr, M_FATAL, 0, _("Wanted Volume \"%s\", but device %s is busy writing on \"%s\" .\n"), 
                  dcr->VolumeName, dev->print_name(), dev->VolHdr.VolumeName);
             goto get_out;
          }
index fdaae01386595a4caed29dd7b739dab480ec86fc..610093cbbf0acba8e3de4a2af96c7296d4cbaa59 100644 (file)
@@ -58,6 +58,7 @@ public:
 
 static dlist *vol_list = NULL;
 static pthread_mutex_t vol_list_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t search_lock = PTHREAD_MUTEX_INITIALIZER;
 
 /* Forward referenced functions */
 static int can_reserve_drive(DCR *dcr, bool PerferMountedVols);
@@ -385,7 +386,7 @@ done:
 bool find_suitable_device_for_job(JCR *jcr, RCTX &rctx)
 {
    bool first = true;
-   bool ok = false;
+   bool ok;
    DCR *dcr = NULL;
    DIRSTORE *store;
    char *device_name;
@@ -393,6 +394,8 @@ bool find_suitable_device_for_job(JCR *jcr, RCTX &rctx)
    init_jcr_device_wait_timers(jcr);
    for ( ;; ) {
       int need_wait = false;
+      ok = false;
+      P(search_lock);
       foreach_alist(store, jcr->dirstore) {
          rctx.store = store;
          foreach_alist(device_name, store->device) {
@@ -409,7 +412,11 @@ bool find_suitable_device_for_job(JCR *jcr, RCTX &rctx)
             /* otherwise error */
 //             rctx->errors.push(bstrdup(jcr->errmsg));
          }
+         if (ok) {
+            break;
+         }
       }
+      V(search_lock);
       /*
        * If there is some device for which we can wait, then
        *  wait and try again until the wait time expires
index 28d081ba10eb82929c6f3ceca74076060dab361e..39aad6a97de7ef342412b21d4b1de75177c63357 100644 (file)
@@ -206,6 +206,7 @@ bool wait_for_device(JCR *jcr, bool first)
       now = time(NULL);
       jcr->rem_wait_sec -= (now - start);
 
+/* Not turned on yet */
 #ifdef needed
       /* Note, this always triggers the first time. We want that. */
       if (me->heartbeat_interval) {
index b5d36d79ec295631383b4d541d270bd4b9c8b406..854f38da65dec193eb3b17d217a5bef0519b46b2 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #undef  VERSION
 #define VERSION "1.37.34"
-#define BDATE   "03 August 2005"
-#define LSMDATE "03Aug05"
+#define BDATE   "04 August 2005"
+#define LSMDATE "04Aug05"
 
 /* Debug flags */
 #undef  DEBUG