From: Kern Sibbald Date: Thu, 10 Jan 2008 15:15:04 +0000 (+0000) Subject: kes Add DataDespooling and DataCommitting status (committing is X-Git-Tag: Release-7.0.0~5141 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2cbc4673d23d052935aeb50eb26ec4af12755207;p=bacula%2Fbacula kes Add DataDespooling and DataCommitting status (committing is the last despooling). kes Finish implementation of new reservations code noted below. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6270 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/ua_status.c b/bacula/src/dird/ua_status.c index 1d267c33b2..d2b067b074 100644 --- a/bacula/src/dird/ua_status.c +++ b/bacula/src/dird/ua_status.c @@ -636,6 +636,12 @@ static void list_running_jobs(UAContext *ua) case JS_WaitPriority: msg = _("is waiting for higher priority jobs to finish"); break; + case JS_DataCommitting: + msg = _("SD committing Data"); + break; + case JS_DataDespooling: + msg = _("SD despooling Data"); + break; case JS_AttrDespooling: msg = _("SD despooling Attributes"); break; @@ -681,6 +687,12 @@ static void list_running_jobs(UAContext *ua) } msg = emsg; break; + case JS_DataCommitting: + msg = _("SD committing Data"); + break; + case JS_DataDespooling: + msg = _("SD despooling Data"); + break; case JS_AttrDespooling: msg = _("SD despooling Attributes"); break; diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index ccef2c32b2..017acdb5eb 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + Copyright (C) 2000-2008 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. @@ -89,6 +89,8 @@ #define JS_WaitPriority 'p' /* Waiting for higher priority jobs to finish */ #define JS_AttrDespooling 'a' /* SD despooling attributes */ #define JS_AttrInserting 'i' /* Doing batch insert file records */ +#define JS_DataDespooling 'l' /* Doing data despooling */ +#define JS_DataCommitting 'L' /* Committing data (last despool) */ /* Migration selection types */ enum { diff --git a/bacula/src/lib/util.c b/bacula/src/lib/util.c index d88714f436..eb13ddcbdf 100644 --- a/bacula/src/lib/util.c +++ b/bacula/src/lib/util.c @@ -230,6 +230,12 @@ void jobstatus_to_ascii(int JobStatus, char *msg, int maxlen) case JS_WaitPriority: jobstat = _("Waiting on Priority"); break; + case JS_DataCommitting: + jobstat = _("SD committing Data"); + break; + case JS_DataDespooling: + jobstat = _("SD despooling Data"); + break; case JS_AttrDespooling: jobstat = _("SD despooling Attributes"); break; diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index 83741679d0..45517b8db5 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -541,6 +541,7 @@ bool release_device(DCR *dcr) * has failed, since the device is not in read mode and * there are no writers. It was probably reserved. */ + volume_unused(dcr); } /* If no writers, close if file or !CAP_ALWAYS_OPEN */ diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index d966a881f0..b285c72e39 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -2732,6 +2732,7 @@ static bool my_mount_next_read_volume(DCR *dcr) Pmsg2(000, _("End of Volume \"%s\" %d records.\n"), dcr->VolumeName, quickie_count); + volume_unused(dcr); /* release current volume */ if (LastBlock != block->BlockNumber) { VolBytes += block->block_len; } diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index 9901774a71..a3594fe54b 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -515,6 +515,7 @@ bail_out: if (!dev->is_open()) { dev->clear_volhdr(); } + volume_unused(dcr); /* no longer using volume */ give_back_device_lock(dev, &hold); return; } diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index b1f8ee0cdf..d02d83f7d8 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -409,6 +409,7 @@ bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName, return true; bail_out: + volume_unused(dcr); dev->clear_volhdr(); dev->clear_append(); /* remove append since this is PRE_LABEL */ return false; diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index 9462815a20..893fdeb778 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2007 Free Software Foundation Europe e.V. + Copyright (C) 2002-2008 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. @@ -625,6 +625,8 @@ bool mount_next_read_volume(DCR *dcr) DEVICE *dev = dcr->dev; JCR *jcr = dcr->jcr; Dmsg2(90, "NumReadVolumes=%d CurReadVolume=%d\n", jcr->NumReadVolumes, jcr->CurReadVolume); + + volume_unused(dcr); /* release current volume */ /* * End Of Tape -- mount next Volume (if another specified) */ diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index 9c7960e684..269be5104c 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -516,7 +516,7 @@ bool volume_unused(DCR *dcr) Dmsg3(dbglvl, "=== mark released vol=%s num_writers=%d reserved=%d\n", dev->vol->vol_name, dev->num_writers, dev->reserved_device); dev->vol->released = true; - if (dev->is_tape() || dev->is_autochanger()) { + if (dev->is_tape()) { // || dev->is_autochanger()) { return true; } else { /* @@ -1142,7 +1142,14 @@ static int reserve_device(RCTX &rctx) dcr->dev_name, dcr->media_type, dcr->pool_name, ok); Dmsg3(dbglvl, "Vol=%s num_writers=%d, have_vol=%d\n", rctx.VolumeName, dcr->dev->num_writers, rctx.have_volume); - if (!rctx.have_volume) { + if (rctx.have_volume) { + if (reserve_volume(dcr, rctx.VolumeName)) { + Dmsg1(dbglvl, "Reserved vol=%s\n", rctx.VolumeName); + } else { + Dmsg1(dbglvl, "Could not reserve vol=%s\n", rctx.VolumeName); + goto bail_out; + } + } else { dcr->any_volume = true; Dmsg0(dbglvl, "no vol, call find_next_appendable_vol.\n"); if (dir_find_next_appendable_volume(dcr)) { @@ -1161,13 +1168,13 @@ static int reserve_device(RCTX &rctx) if (dcr->volume_in_use && !rctx.PreferMountedVols) { rctx.PreferMountedVols = true; if (dcr->VolumeName[0]) { - volume_unused(dcr); + unreserve_device(dcr); } goto bail_out; } /* * Note. Under some circumstances, the Director can hand us - * a Volume name that is no the same as the one on the current + * a Volume name that is not the same as the one on the current * drive, and in that case, the call above to find the next * volume will fail because in attempting to reserve the Volume * the code will realize that we already have a tape mounted, @@ -1178,7 +1185,7 @@ static int reserve_device(RCTX &rctx) */ if (dcr->dev->num_writers != 0) { if (dcr->VolumeName[0]) { - volume_unused(dcr); + unreserve_device(dcr); } goto bail_out; } @@ -1214,7 +1221,6 @@ static int reserve_device(RCTX &rctx) bail_out: rctx.have_volume = false; rctx.VolumeName[0] = 0; -// free_dcr(dcr); Dmsg0(dbglvl, "Not OK.\n"); return 0; } diff --git a/bacula/src/stored/spool.c b/bacula/src/stored/spool.c index 25eb7c12d5..34a1da2d38 100644 --- a/bacula/src/stored/spool.c +++ b/bacula/src/stored/spool.c @@ -232,10 +232,14 @@ static bool despool_data(DCR *dcr, bool commit) Jmsg(jcr, M_INFO, 0, _("Committing spooled data to Volume \"%s\". Despooling %s bytes ...\n"), jcr->dcr->VolumeName, edit_uint64_with_commas(jcr->dcr->job_spool_size, ec1)); + set_jcr_job_status(jcr, JS_DataCommitting); } else { Jmsg(jcr, M_INFO, 0, _("Writing spooled data to Volume. Despooling %s bytes ...\n"), edit_uint64_with_commas(jcr->dcr->job_spool_size, ec1)); + set_jcr_job_status(jcr, JS_DataDespooling); } + set_jcr_job_status(jcr, JS_DataDespooling); + dir_send_job_status(jcr); dcr->despool_wait = true; dcr->spooling = false; /* @@ -337,6 +341,7 @@ static bool despool_data(DCR *dcr, bool commit) free(rdev); dcr->spooling = true; /* turn on spooling again */ dcr->despooling = false; + /* * We are done, so unblock the device, but if we have done a * commit, leave it locked so that the job cleanup does not @@ -348,6 +353,8 @@ static bool despool_data(DCR *dcr, bool commit) if (!commit) { dcr->dunlock(); } + set_jcr_job_status(jcr, JS_Running); + dir_send_job_status(jcr); return ok; } diff --git a/bacula/src/version.h b/bacula/src/version.h index e127cca19d..db3137b2ea 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,10 +4,10 @@ #undef VERSION #define VERSION "2.3.8" -#define BDATE "06 January 2008" -#define LSMDATE "06Jan08" +#define BDATE "10 January 2008" +#define LSMDATE "10Jan08" -#define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" +#define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ /* diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index abff2d0aef..9522891bc2 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,11 +1,15 @@ Technical notes on version 2.3 General: +10Jan08 +kes Add DataDespooling and DataCommitting status (committing is + the last despooling). +kes Finish implementation of new reservations code noted below. 08Jan08 +kes Fix bsnprintf for float point numbers. I broke recently when + parameterizing some variables. This fixes bug #1036. kes Undo recent reservations changes ... will apply them later when they work better. -kes Fix bsnprintf for float point numbers. I broke recently when - parameterizing some variables. 06Jan08 ebl Fixes #1034 which cause mysql to hang the connection after 8h ebl Change default statistics target of filename.name and path.path @@ -37,6 +41,8 @@ ebl Fixes bug #1028 where "Selection Type" option was not usable with JobDefs. ebl Fixes bug #897 and bug #1005 where bacula doesn't display runscript output in error. + +Release Version 2.2.7 24Dec07 kes Add new free_tls() entry point so that Win32 builds. kes Fix compile warning in src/lib/util.c