From b3a6e5b0dc12cd9af3f41e89e68d60ab23f950b7 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 21 Apr 2007 09:09:35 +0000 Subject: [PATCH] Print waiting to reserve a device every 5 mins. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4577 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 106 -------------------------------- bacula/src/stored/autochanger.c | 5 +- bacula/src/stored/protos.h | 2 +- bacula/src/stored/reserve.c | 5 +- bacula/src/stored/wait.c | 9 ++- bacula/src/version.h | 4 +- bacula/technotes-2.1 | 2 + 7 files changed, 15 insertions(+), 118 deletions(-) diff --git a/bacula/kernstodo b/bacula/kernstodo index b80dacf5b8..c7303824c3 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -1688,109 +1688,3 @@ Block Position: 0 === Done -- Make sure that all do_prompt() calls in Dir check for - -1 (error) and -2 (cancel) returns. -- Fix foreach_jcr() to have free_jcr() inside next(). - jcr=jcr_walk_start(); - for ( ; jcr; (jcr=jcr_walk_next(jcr)) ) - ... - jcr_walk_end(jcr); -- A Volume taken from Scratch should take on the retention period - of the new pool. -- Correct doc for Maximum Changer Wait (and others) accepting only - integers. -- Implement status that shows why a job is being held in reserve, or - rather why none of the drives are suitable. -- Implement a way to disable a drive (so you can use the second - drive of an autochanger, and the first one will not be used or - even defined). -- Make sure Maximum Volumes is respected in Pools when adding - Volumes (e.g. when pulling a Scratch volume). -- Keep same dcr when switching device ... -- Implement code that makes the Dir aware that a drive is an - autochanger (so the user doesn't need to use the Autochanger = yes - directive). -- Make catalog respect ACL. -- Add recycle count to Media record. -- Add initial write date to Media record. -- Fix store_yesno to be store_bitmask. ---- create_file.c.orig Fri Jul 8 12:13:05 2005 -+++ create_file.c Fri Jul 8 12:13:07 2005 -@@ -195,6 +195,8 @@ - attr->ofname, be.strerror()); - return CF_ERROR; - } -+ } else if(S_ISSOCK(attr->statp.st_mode)) { -+ Dmsg1(200, "Skipping socket: %s\n", attr->ofname); - } else { - Dmsg1(200, "Restore node: %s\n", attr->ofname); - if (mknod(attr->ofname, attr->statp.st_mode, attr->statp.st_rdev) != 0 && errno != EEXIST) { -- Add true/false to conf same as yes/no -- Reserve blocks other restore jobs when first cannot connect to SD. -- Fix Maximum Changer Wait, Maximum Open Wait, Maximum Rewind Wait to - accept time qualifiers. -- Does ClientRunAfterJob fail the job on a bad return code? -- Make hardlink code at line 240 of find_one.c use binary search. -- Add ACL error messages in src/filed/acl.c. -- Make authentication failures single threaded. -- Make Dir and SD authentication errors single threaded. -- Fix catreq.c digestbuf at line 411 in src/dird/catreq.c -- Make base64.c (bin_to_base64) take a buffer length - argument to avoid overruns. - and verify that other buffers cannot overrun. -- Implement VolumeState as discussed with Arno. -- Add LocationId to update volume -- Add LocationLog - LogId - Date - User text - MediaId - LocationId - NewState??? -- Add Comment to Media record -- Fix auth compatibility with 1.38 -- Update dbcheck to include Log table -- Update llist to include new fields. -- Make unmount unload autochanger. Make mount load slot. -- Fix bscan to report the JobType when restoring a job. -- Fix wx-console scanning problem with commas in names. -- Add manpages to the list of directories for make install. Notify - Scott -- Add bconsole option to use stdin/out instead of conio. -- Fix ClientRunBefore/AfterJob compatibility. -- Ensure that connection to daemon failure always indicates what - daemon it was trying to connect to. -- Freespace on DVD requested over and over even with no intervening - writes. -- .update volume [enabled|disabled|*see below] - > However, I could easily imagine an option to "update slots" that says - > "enable=yes|no" that would automatically enable or disable all the Volumes - > found in the autochanger. This will permit the user to optionally mark all - > the Volumes in the magazine disabled prior to taking them offsite, and mark - > them all enabled when bringing them back on site. Coupled with the options - > to the slots keyword, you can apply the enable/disable to any or all volumes. -- Restricted consoles start in the Default catalog even if it - is not permitted. -- When reading through parts on the DVD, the DVD is mounted and - unmounted for each part. -- Make sure that the restore options don't permit "seeing" other - Client's job data. -- Restore of a raw drive should not try to check the volume size. -- Lock tape drive door when open() -- Make release unload any autochanger. -- Arno's reservation deadlock. -- Eric's SD patch -- Make sure the new level=Full syntax is used in all - example conf files (especially in the manual). -- Fix prog copyright (SD) all other files. -- Document need for UTF-8 format -- Try turning on disk seek code. -- Some users claim that they must do two prune commands to get a - Volume marked as purged. -- Document fact that CatalogACL now needed for Tray monitor (fixed). -- If you have two Catalogs, it will take the first one. -- Migration Volume span bug -- Rescue release -- Bug reports -- Change gnome-console to bgnome-console. -- Change wx-console to bwx-console diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index dc6dae98c1..6a2309c67d 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -380,7 +380,7 @@ static bool unload_other_drive(DCR *dcr, int slot) AUTOCHANGER *changer = dcr->dev->device->changer_res; DEVRES *device; bool found = false; - bool first = true; + int retries = 0; /* wait for device retries */ if (!changer) { return false; @@ -408,8 +408,7 @@ static bool unload_other_drive(DCR *dcr, int slot) } for (int i=0; i < 3; i++) { if (dev->is_busy()) { - wait_for_device(dcr->jcr, first); - first = false; + wait_for_device(dcr->jcr, retries); continue; } break; diff --git a/bacula/src/stored/protos.h b/bacula/src/stored/protos.h index 00b52d4771..3f9913711c 100644 --- a/bacula/src/stored/protos.h +++ b/bacula/src/stored/protos.h @@ -264,4 +264,4 @@ void list_spool_stats (void sendit(const char *msg, int len, void *s /* From wait.c */ int wait_for_sysop(DCR *dcr); -bool wait_for_device(JCR *jcr, bool first); +bool wait_for_device(JCR *jcr, int &retries); diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index bea00ddda1..ae0ad4175a 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -596,7 +596,7 @@ static bool use_storage_cmd(JCR *jcr) * Wiffle through them and find one that can do the backup. */ if (ok) { - bool first = true; /* print wait message once */ + int retries = 0; /* wait for device retries */ bool fail = false; rctx.notify_dir = true; lock_reservations(); @@ -665,12 +665,11 @@ static bool use_storage_cmd(JCR *jcr) } /* Keep reservations locked *except* during wait_for_device() */ unlock_reservations(); - if (!rctx.suitable_device || !wait_for_device(jcr, first)) { + if (!rctx.suitable_device || !wait_for_device(jcr, retries)) { Dmsg0(100, "Fail. !suitable_device || !wait_for_device\n"); fail = true; } lock_reservations(); - first = false; bnet_sig(dir, BNET_HEARTBEAT); /* Inform Dir that we are alive */ } unlock_reservations(); diff --git a/bacula/src/stored/wait.c b/bacula/src/stored/wait.c index 65535d5a92..fe634e4507 100644 --- a/bacula/src/stored/wait.c +++ b/bacula/src/stored/wait.c @@ -199,7 +199,7 @@ int wait_for_sysop(DCR *dcr) * Returns: true if a device has changed state * false if the total wait time has expired. */ -bool wait_for_device(JCR *jcr, bool first) +bool wait_for_device(JCR *jcr, int &retries) { struct timeval tv; struct timezone tz; @@ -207,12 +207,15 @@ bool wait_for_device(JCR *jcr, bool first) int stat = 0; bool ok = true; const int max_wait_time = 1 * 60; /* wait 1 minute */ + char ed1[50]; Dmsg0(100, "Enter wait_for_device\n"); P(device_release_mutex); - if (first) { - Jmsg(jcr, M_MOUNT, 0, _("Job %s waiting to reserve a device.\n"), jcr->Job); + if (++retries % 5 == 0) { + /* Print message every 5 minutes */ + Jmsg(jcr, M_MOUNT, 0, _("JobId=%s, Job %s waiting to reserve a device.\n"), + edit_uint64(jcr->JobId, ed1), jcr->Job); } gettimeofday(&tv, &tz); diff --git a/bacula/src/version.h b/bacula/src/version.h index d35b786d65..a7f8db42da 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.1.8" -#define BDATE "20 April 2007" -#define LSMDATE "20Apr07" +#define BDATE "21 April 2007" +#define LSMDATE "21Apr07" #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 ee036e8811..7b6632d6dc 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -1,6 +1,8 @@ Technical notes on version 2.1 General: +21Apr07 +kes Print waiting to reserve a device every 5 mins. 20Apr07 kes Don't call close_part in label.c if tape and relabel. kes Don't free volume if busy in close() -- should help with -- 2.39.5