From 4520b4845b1f033f2de12570371e2a5cb53ac6c0 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 24 Nov 2004 17:16:58 +0000 Subject: [PATCH] - Take Dan's fix to the fix_postgresql_tables (thanks Dan) - Increase Maximum Concurrent Jobs to 20 in SD and FD! - Fix improper handling of autochanger Volumes that are not marked InChanger. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1718 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/kernstodo | 3 +- bacula/patches/fix_postgresql_tables | 10 +++-- bacula/src/cats/fix_postgresql_tables | 10 +++-- bacula/src/filed/bacula-fd.conf.in | 2 +- bacula/src/stored/bacula-sd.conf.in | 2 +- bacula/src/stored/dircmd.c | 59 +++++++++++++++------------ bacula/src/version.h | 4 +- 7 files changed, 52 insertions(+), 38 deletions(-) diff --git a/bacula/kernstodo b/bacula/kernstodo index b8e483b48c..683cd3a5fc 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -25,6 +25,8 @@ For 1.36.1: 1.37 Possibilities: +- Document testing +- Add performance testing hooks - if 2 concurrent backups are attempted on the same tape drive (autoloader) into different tape pools, one of them will exit fatally instead of halting until the drive is idle @@ -998,4 +1000,3 @@ Block Position: 0 - Fix CDROM make script to permit picking up already installed static FD. - Add date/time to each Jmsg. - diff --git a/bacula/patches/fix_postgresql_tables b/bacula/patches/fix_postgresql_tables index 4d835df68e..2d69f89278 100755 --- a/bacula/patches/fix_postgresql_tables +++ b/bacula/patches/fix_postgresql_tables @@ -14,11 +14,15 @@ bindir=****EDIT-ME to be the path to psql**** if $bindir/psql $* -f - <dcr; int label_status; + dcr->dev = dev; steal_device_lock(dev, &hold, BST_WRITING_LABEL); - bstrncpy(dcr->VolumeName, newname, sizeof(dcr->VolumeName)); - dcr->VolCatInfo.Slot = slot; - if (autoload_device(dcr, 0, dir) < 0) { /* autoload if possible */ - goto bail_out; - } - - /* Ensure that the device is open -- autoload_device() closes it */ - for ( ; !(dev->state & ST_OPENED); ) { - if (open_dev(dev, dcr->VolumeName, OPEN_READ_WRITE) < 0) { - bnet_fsend(dir, _("3910 Unable to open device %s. ERR=%s\n"), - dev_name(dev), strerror_dev(dev)); - goto bail_out; - } + if (!try_autoload_device(jcr, slot, newname)) { + goto bail_out; /* error */ } /* See what we have for a Volume */ @@ -845,22 +836,12 @@ static void read_volume_label(JCR *jcr, DEVICE *dev, int Slot) BSOCK *dir = jcr->dir_bsock; bsteal_lock_t hold; DCR *dcr = jcr->dcr; - + + dcr->dev = dev; steal_device_lock(dev, &hold, BST_WRITING_LABEL); - dcr->VolumeName[0] = 0; - dcr->VolCatInfo.Slot = Slot; - if (autoload_device(dcr, 0, dir) < 0) { /* autoload if possible */ - goto bail_out; - } - - /* Ensure that the device is open -- autoload_device() closes it */ - for ( ; !dev_state(dev, ST_OPENED); ) { - if (open_dev(dev, dcr->VolumeName, OPEN_READ_WRITE) < 0) { - bnet_fsend(dir, _("3910 Unable to open device \"%s\". ERR=%s\n"), - dev_name(dev), strerror_dev(dev)); - goto bail_out; - } + if (!try_autoload_device(jcr, Slot, "")) { + goto bail_out; /* error */ } dev->state &= ~ST_LABEL; /* force read of label */ @@ -880,3 +861,27 @@ bail_out: give_back_device_lock(dev, &hold); return; } + +static bool try_autoload_device(JCR *jcr, int slot, const char *VolName) +{ + DCR *dcr = jcr->dcr; + BSOCK *dir = jcr->dir_bsock; + DEVICE *dev = dcr->dev; + + bstrncpy(dcr->VolumeName, VolName, sizeof(dcr->VolumeName)); + dcr->VolCatInfo.Slot = slot; + dcr->VolCatInfo.InChanger = slot > 0; + if (autoload_device(dcr, 0, dir) < 0) { /* autoload if possible */ + return false; + } + + /* Ensure that the device is open -- autoload_device() closes it */ + for ( ; !(dev->state & ST_OPENED); ) { + if (open_dev(dev, dcr->VolumeName, OPEN_READ_WRITE) < 0) { + bnet_fsend(dir, _("3910 Unable to open device %s. ERR=%s\n"), + dev_name(dev), strerror_dev(dev)); + return false; + } + } + return true; +} diff --git a/bacula/src/version.h b/bacula/src/version.h index 3ee8d8a11c..7cc3d2a284 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,8 +1,8 @@ /* */ #undef VERSION #define VERSION "1.36.1" -#define BDATE "22 November 2004" -#define LSMDATE "22Nov04" +#define BDATE "24 November 2004" +#define LSMDATE "24Nov04" /* Debug flags */ #undef DEBUG -- 2.39.5