From 21b7c18e147f584cf0c2f836266b432856b41980 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 2 Mar 2007 18:02:46 +0000 Subject: [PATCH] 02Mar07 kes Modify jobq.c to let simultaneous restore jobs run. This may cause them to fail if they cannot get a drive. kes Add Client Connect Wait to Storage daemon to permit users to modify the time the SD waits for a FD connection. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4294 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 2 ++ bacula/src/dird/jobq.c | 19 ++++++++++--------- bacula/src/stored/job.c | 21 +++++++++++---------- bacula/src/stored/stored_conf.c | 17 +++++++++-------- bacula/src/stored/stored_conf.h | 1 + bacula/src/version.h | 4 ++-- bacula/technotes-2.1 | 5 +++++ 7 files changed, 40 insertions(+), 29 deletions(-) diff --git a/bacula/kernstodo b/bacula/kernstodo index 306bf100e2..0bcd308589 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -43,6 +43,8 @@ Document: Priority: +- Add Catalog = to Pool resource so that pools will exist + in only one catalog -- currently Pools are "global". - Look at sg_logs -a /dev/sg0 for getting soft errors. - btape "test" command with Offline on Unmount = yes diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index 780b2f258f..d811bda771 100644 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -682,13 +682,14 @@ static bool acquire_resources(JCR *jcr) jcr->acquired_resource_locks = false; if (jcr->rstore) { Dmsg1(200, "Rstore=%s\n", jcr->rstore->name()); - /* - * Let only one Restore/verify job run at a time regardless - * of MaxConcurrentJobs. - */ - if (jcr->rstore->NumConcurrentJobs == 0) { + if (jcr->rstore->NumConcurrentJobs == 0 && + jcr->rstore->NumConcurrentJobs < jcr->rstore->MaxConcurrentJobs) { + /* Simple case, first job */ jcr->rstore->NumConcurrentJobs = 1; Dmsg0(200, "Set rncj=1\n"); + } else if (jcr->rstore->NumConcurrentJobs < jcr->rstore->MaxConcurrentJobs) { + jcr->rstore->NumConcurrentJobs++; + Dmsg1(200, "Inc rncj=%d\n", jcr->rstore->NumConcurrentJobs); } else { Dmsg1(200, "Fail rncj=%d\n", jcr->rstore->NumConcurrentJobs); set_jcr_job_status(jcr, JS_WaitStoreRes); @@ -699,7 +700,7 @@ static bool acquire_resources(JCR *jcr) if (jcr->wstore) { Dmsg1(200, "Wstore=%s\n", jcr->wstore->name()); if (jcr->rstore == jcr->wstore) { /* deadlock */ - jcr->rstore->NumConcurrentJobs = 0; /* back out rstore */ + jcr->rstore->NumConcurrentJobs--; /* back out rstore */ Jmsg(jcr, M_FATAL, 0, _("Job canceled. Attempt to read and write same device.\n" " Read storage \"%s\" (From %s) -- Write storage \"%s\" (From %s)\n"), jcr->rstore->name(), jcr->rstore_source, jcr->wstore->name(), jcr->wstore_source); @@ -715,7 +716,7 @@ static bool acquire_resources(JCR *jcr) jcr->wstore->NumConcurrentJobs++; Dmsg1(200, "Inc wncj=%d\n", jcr->wstore->NumConcurrentJobs); } else if (jcr->rstore) { - jcr->rstore->NumConcurrentJobs = 0; /* back out rstore */ + jcr->rstore->NumConcurrentJobs--; /* back out rstore */ Dmsg1(200, "Fail wncj=%d\n", jcr->wstore->NumConcurrentJobs); skip_this_jcr = true; } else { @@ -737,7 +738,7 @@ static bool acquire_resources(JCR *jcr) Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs); } if (jcr->rstore) { - jcr->rstore->NumConcurrentJobs = 0; + jcr->rstore->NumConcurrentJobs--; Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs); } set_jcr_job_status(jcr, JS_WaitClientRes); @@ -752,7 +753,7 @@ static bool acquire_resources(JCR *jcr) Dmsg1(200, "Dec wncj=%d\n", jcr->wstore->NumConcurrentJobs); } if (jcr->rstore) { - jcr->rstore->NumConcurrentJobs = 0; + jcr->rstore->NumConcurrentJobs--; Dmsg1(200, "Dec rncj=%d\n", jcr->rstore->NumConcurrentJobs); } jcr->client->NumConcurrentJobs--; diff --git a/bacula/src/stored/job.c b/bacula/src/stored/job.c index 57cc0487e5..856e531588 100644 --- a/bacula/src/stored/job.c +++ b/bacula/src/stored/job.c @@ -1,11 +1,3 @@ -/* - * Job control and execution for Storage Daemon - * - * Kern Sibbald, MM - * - * Version $Id$ - * - */ /* Bacula® - The Network Backup Solution @@ -33,6 +25,14 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * Job control and execution for Storage Daemon + * + * Kern Sibbald, MM + * + * Version $Id$ + * + */ #include "bacula.h" #include "stored.h" @@ -166,9 +166,10 @@ bool run_cmd(JCR *jcr) gettimeofday(&tv, &tz); timeout.tv_nsec = tv.tv_usec * 1000; - timeout.tv_sec = tv.tv_sec + 30 * 60; /* wait 30 minutes */ + timeout.tv_sec = tv.tv_sec + me->client_wait; - Dmsg1(100, "%s waiting on FD to contact SD\n", jcr->Job); + Dmsg2(100, "%s waiting %d sec for FD to contact SD\n", + jcr->Job, (int)me->client_wait); /* * Wait for the File daemon to contact us to start the Job, * when he does, we will be released, unless the 30 minutes diff --git a/bacula/src/stored/stored_conf.c b/bacula/src/stored/stored_conf.c index ec5632a41a..bae09e0b2d 100644 --- a/bacula/src/stored/stored_conf.c +++ b/bacula/src/stored/stored_conf.c @@ -1,14 +1,7 @@ -/* - * Configuration file parser for Bacula Storage daemon - * - * Kern Sibbald, March MM - * - * Version $Id$ - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2006 Free Software Foundation Europe e.V. + Copyright (C) 2000-2007 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -32,6 +25,13 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * Configuration file parser for Bacula Storage daemon + * + * Kern Sibbald, March MM + * + * Version $Id$ + */ #include "bacula.h" #include "stored.h" @@ -86,6 +86,7 @@ static RES_ITEM store_items[] = { {"tlskey", store_dir, ITEM(res_store.tls_keyfile), 0, 0, 0}, {"tlsdhfile", store_dir, ITEM(res_store.tls_dhfile), 0, 0, 0}, {"tlsallowedcn", store_alist_str, ITEM(res_store.tls_allowed_cns), 0, 0, 0}, + {"clientconnectwait", store_time, ITEM(res_store.client_wait), 0, ITEM_DEFAULT, 30 * 60}, {NULL, NULL, {0}, 0, 0, 0} }; diff --git a/bacula/src/stored/stored_conf.h b/bacula/src/stored/stored_conf.h index 42461d3aa3..7b7467de91 100644 --- a/bacula/src/stored/stored_conf.h +++ b/bacula/src/stored/stored_conf.h @@ -86,6 +86,7 @@ public: uint32_t max_concurrent_jobs; /* maximum concurrent jobs to run */ MSGS *messages; /* Daemon message handler */ utime_t heartbeat_interval; /* Interval to send hb to FD */ + utime_t client_wait; /* Time to wait for FD to connect */ int tls_enable; /* Enable TLS */ int tls_require; /* Require TLS */ int tls_verify_peer; /* TLS Verify Client Certificate */ diff --git a/bacula/src/version.h b/bacula/src/version.h index d19cf37086..746cab77e5 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.1.4" -#define BDATE "21 February 2007" -#define LSMDATE "21Feb07" +#define BDATE "02 March 2007" +#define LSMDATE "02Mar07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index f31be91d43..d545766264 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,6 +1,11 @@ Technical notes on version 2.1 General: +02Mar07 +kes Modify jobq.c to let simultaneous restore jobs run. This may + cause them to fail if they cannot get a drive. +kes Add Client Connect Wait to Storage daemon to permit users to + modify the time the SD waits for a FD connection. 29Feb07 kes Correct virtual changer check which was backwards. This caused volumes to be unloaded into slots already occupied. -- 2.39.5