]> git.sur5r.net Git - bacula/bacula/commitdiff
Make restore jobs wait for exclusive use of Storage device
authorKern Sibbald <kern@sibbald.com>
Tue, 1 Jun 2004 20:10:04 +0000 (20:10 +0000)
committerKern Sibbald <kern@sibbald.com>
Tue, 1 Jun 2004 20:10:04 +0000 (20:10 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1381 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/jobq.c
bacula/src/jcr.h
bacula/src/version.h

index 9fc62f3f8f4a84c57989a4eaa3c6bb0ad3469159..112584fcd48be856f4802547e4242842f9b13762 100755 (executable)
@@ -443,6 +443,9 @@ static void *jobq_server(void *arg)
          */
         if (jcr->acquired_resource_locks) {
            jcr->store->NumConcurrentJobs--;
+           if (jcr->JobType == JT_RESTORE) {
+              jcr->store->MaxConcurrentJobs = jcr->saveMaxConcurrentJobs;  
+           }
            jcr->client->NumConcurrentJobs--;
            jcr->job->NumConcurrentJobs--;
         }
@@ -532,17 +535,33 @@ static void *jobq_server(void *arg)
               set_jcr_job_status(jcr, JS_WaitPriority);
               break;
            }
-           if (jcr->store->NumConcurrentJobs < jcr->store->MaxConcurrentJobs) {
+           if (jcr->JobType == JT_RESTORE) {
+              /* Let only one Restore job run at a time regardless of MaxConcurrentJobs */
+              if (jcr->store->NumConcurrentJobs == 0) {
+                 jcr->store->NumConcurrentJobs++;
+                 jcr->saveMaxConcurrentJobs = jcr->store->MaxConcurrentJobs;
+                 jcr->store->MaxConcurrentJobs = 1;
+              } else {
+                 set_jcr_job_status(jcr, JS_WaitStoreRes);
+                 je = jn;
+                 continue;
+              }
+           } else if (jcr->store->NumConcurrentJobs < jcr->store->MaxConcurrentJobs) {
               jcr->store->NumConcurrentJobs++;
            } else {
               set_jcr_job_status(jcr, JS_WaitStoreRes);
               je = jn;
               continue;
            }
+
            if (jcr->client->NumConcurrentJobs < jcr->client->MaxConcurrentJobs) {
               jcr->client->NumConcurrentJobs++;
            } else {
+              /* Back out previous locks */
               jcr->store->NumConcurrentJobs--;
+              if (jcr->JobType == JT_RESTORE) {
+                 jcr->store->MaxConcurrentJobs = jcr->saveMaxConcurrentJobs;  
+              }
               set_jcr_job_status(jcr, JS_WaitClientRes);
               je = jn;
               continue;
@@ -550,7 +569,11 @@ static void *jobq_server(void *arg)
            if (jcr->job->NumConcurrentJobs < jcr->job->MaxConcurrentJobs) {
               jcr->job->NumConcurrentJobs++;
            } else {
+              /* Back out previous locks */
               jcr->store->NumConcurrentJobs--;
+              if (jcr->JobType == JT_RESTORE) {
+                 jcr->store->MaxConcurrentJobs = jcr->saveMaxConcurrentJobs;  
+              }
               jcr->client->NumConcurrentJobs--;
               set_jcr_job_status(jcr, JS_WaitJobRes);
               je = jn;
index 6f037c77abcca813c78a3ea9dcba439bf558da33..720d3ef43294ad3efdc0dbb3e0a5ac1402ec35d5 100644 (file)
@@ -175,6 +175,7 @@ struct JCR {
    uint32_t RestoreJobId;             /* Id specified by UA */
    POOLMEM *client_uname;             /* client uname */ 
    int replace;                       /* Replace option */
+   int saveMaxConcurrentJobs;         /* save for restore jobs */
    bool acquired_resource_locks;      /* set if resource locks acquired */
    int NumVols;                       /* Number of Volume used in pool */
    int reschedule_count;              /* Number of times rescheduled */
index a33d94ca73e41be85f755eac0f33560f77dd2532..70903504ac66e6f7715169583907d6ac0a91080e 100644 (file)
@@ -2,8 +2,8 @@
 #undef  VERSION
 #define VERSION "1.34.3"
 #define VSTRING "1"
-#define BDATE   "31 May 2004"
-#define LSMDATE "31May04"
+#define BDATE   "01 June 2004"
+#define LSMDATE "01Jun04"
 
 /* Debug flags */
 #undef  DEBUG