*
*/
/*
- Copyright (C) 2000-2003 Kern Sibbald and John Walker
+ Copyright (C) 2003-2004 Kern Sibbald and John Walker
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
/* Forward referenced functions */
-static void *jobq_server(void *arg);
+extern "C" void *jobq_server(void *arg);
+extern "C" void *sched_wait(void *arg);
+
static int start_server(jobq_t *jq);
/*
* most jobs are put into the job queue only when their
* scheduled time arives.
*/
-static void *sched_wait(void *arg)
+extern "C"
+void *sched_wait(void *arg)
{
JCR *jcr = ((wait_pkt *)arg)->jcr;
jobq_t *jq = ((wait_pkt *)arg)->jq;
return NULL;
}
-
/*
* Add a job to the queue
* jq is a queue that was created with jobq_init
* When all the resources are acquired for the job,
* it will call the user's engine.
*/
-static void *jobq_server(void *arg)
+extern "C"
+void *jobq_server(void *arg)
{
struct timespec timeout;
jobq_t *jq = (jobq_t *)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--;
}
jcr->JobStatus != JS_Canceled &&
jcr->job->RescheduleTimes > 0 &&
jcr->reschedule_count < jcr->job->RescheduleTimes) {
+ char dt[50];
/*
* Reschedule this job by cleaning it up, but
jcr->sched_time = time(NULL) + jcr->job->RescheduleInterval;
Dmsg2(300, "Rescheduled Job %s to re-run in %d seconds.\n", jcr->Job,
(int)jcr->job->RescheduleInterval);
+ bstrftime(dt, sizeof(dt), time(NULL));
+ Jmsg(jcr, M_INFO, 0, _("Rescheduled Job %s at %s to re-run in %d seconds.\n"),
+ jcr->Job, dt, (int)jcr->job->RescheduleInterval);
jcr->JobStatus = JS_Created; /* force new status */
dird_free_jcr(jcr); /* partial cleanup old stuff */
if (jcr->JobBytes == 0) {
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;
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;