From: <ke...@us...> - 2008-03-31 16:52:46
|
Revision: 6708 http://bacula.svn.sourceforge.net/bacula/?rev=6708&view=rev Author: kerns Date: 2008-03-31 09:52:42 -0700 (Mon, 31 Mar 2008) Log Message: ----------- kes Remember what volume is in VTLs (previously turned off for testing). kes Analysis of JobMedia records by Tom Ivar Helbekkmo <ti...@ha...> pointed out some problems in creating JobMedia records during spooling with concurrent jobs. Fix the problem by updating the start file position before despooling and generate a jobmedia record at the end of despooling. Modified Paths: -------------- trunk/bacula/kernstodo trunk/bacula/src/stored/reserve.c trunk/bacula/src/stored/spool.c trunk/bacula/src/version.h trunk/bacula/technotes-2.3 Modified: trunk/bacula/kernstodo =================================================================== --- trunk/bacula/kernstodo 2008-03-31 12:31:43 UTC (rev 6707) +++ trunk/bacula/kernstodo 2008-03-31 16:52:42 UTC (rev 6708) @@ -70,21 +70,41 @@ and http://www.openeyet.nl/scc/ for managing customer changes Priority: +================ +Tom Ivar Helbekkmo <ti...@ha...> > There's definitely something fishy in the recording of start and -> end blocks in the JOBMEDIA table. This is a snip from last night's -> incremental run (still using 2.2.8 plus the four published patches, plus -> my posted fix for the jobmedia patch): +> end blocks in the JOBMEDIA table. +> - If several jobs start spooling at the same time, they will all get the +> current tape position noted as the StartFile/StartBlock for the job. +> If they end up despooling to the file that was current when they +> started spooling, this is what will end up in the JOBMEDIA table. If +> there is a file change before they despool, the setting of NewFile in +> the dcr structure will fix this up later, but the "start of session" +> label is already in the spool file, of course, so it holds the wrong +> information anyway. > -> JmId | JID | MId | FI | LI | Sfile | Efile | Sblock | Eblock ->- 119 | 26 | 3 | 1 | 53 | 31 | 31 | 0 | 32 - 120 | 27 | 3 | 1 | 83 | 31 | 31 | 0 | 242 - 121 | 28 | 3 | 1 | 239 | 31 | 31 | 0 | 5683 +> - If the job is longer than the maximum spool size, it will get its +> first spool session despooled, and then start spooling again after the +> first despooling is over. The last blocks despooled to tape from the +> first session will not have been recorded, but they will be flushed +> later, when the next session despools. However, if another job has +> been despooling while this one is spooling its second round, the +> session label written to the spool file at its close will cause the +> EndFile/Endblock to be set to wherever the tape is at that time. When +> the dangling record is flushed to JOBMEDIA, it gets this wrong +> information. Both session labels in the spool file will be wrong, +> too, of course, because they reflect the state of the tape during +> spooling, not during despooling. > -> Since I'm using spooling, those jobs should not be interspersed on -> tape. Still, at least it seems the error is in including too many -> blocks in the set that a job's files occupies, so if I understand -> correctly, it shouldn't cause any restore problems. :) +> I would have to study the code much more closely to work out what's the +> proper fix -- but it seems clear that it should involve creating the +> session labels only when something is actually written to the archive +> device, not during spooling. I'm tempted to try making do_append_data() +> not create session labels if we're spooling, and add the making of them +> to despool_data() in stored/spool.c. Sound reasonable? +=========== + - Re-check new dcr->reserved_volume - Softlinks that point to non-existent file are not restored in restore all, but are restored if the file is individually selected. BUG! Modified: trunk/bacula/src/stored/reserve.c =================================================================== --- trunk/bacula/src/stored/reserve.c 2008-03-31 12:31:43 UTC (rev 6707) +++ trunk/bacula/src/stored/reserve.c 2008-03-31 16:52:42 UTC (rev 6708) @@ -540,7 +540,7 @@ dev->vol->released = true; Dmsg2(dbglvl, "=== set released. Vol=%s dev=%s\n", dev->vol->vol_name, dev->print_name()); - if (dev->is_tape()) { // || dev->is_autochanger()) { + if (dev->is_tape() || dev->is_autochanger()) { return true; } else { /* Modified: trunk/bacula/src/stored/spool.c =================================================================== --- trunk/bacula/src/stored/spool.c 2008-03-31 12:31:43 UTC (rev 6707) +++ trunk/bacula/src/stored/spool.c 2008-03-31 16:52:42 UTC (rev 6708) @@ -248,9 +248,6 @@ dcr->dblock(BST_DESPOOLING); dcr->despool_wait = false; dcr->despooling = true; - if (!dcr->NewVol) { - set_start_vol_position(dcr); - } /* * This is really quite kludgy and should be fixed some time. @@ -281,6 +278,8 @@ /* Add run time, to get current wait time */ time_t despool_start = time(NULL) - jcr->run_time; + set_new_file_parameters(dcr); + for ( ; ok; ) { if (job_canceled(jcr)) { ok = false; @@ -301,6 +300,13 @@ Dmsg3(800, "Write block ok=%d FI=%d LI=%d\n", ok, block->FirstIndex, block->LastIndex); } + if (!dir_create_jobmedia_record(dcr)) { + Jmsg(jcr, M_FATAL, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"), + dcr->VolCatInfo.VolCatName, jcr->Job); + } + /* Set new file/block parameters for current dcr */ + set_new_file_parameters(dcr); + /* Subtracting run_time give us elapsed time - wait_time since we started despooling */ time_t despool_elapsed = time(NULL) - despool_start - jcr->run_time; Modified: trunk/bacula/src/version.h =================================================================== --- trunk/bacula/src/version.h 2008-03-31 12:31:43 UTC (rev 6707) +++ trunk/bacula/src/version.h 2008-03-31 16:52:42 UTC (rev 6708) @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.3.14" -#define BDATE "26 March 2008" -#define LSMDATE "26Mar08" +#define BDATE "31 March 2008" +#define LSMDATE "31Mar08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ Modified: trunk/bacula/technotes-2.3 =================================================================== --- trunk/bacula/technotes-2.3 2008-03-31 12:31:43 UTC (rev 6707) +++ trunk/bacula/technotes-2.3 2008-03-31 16:52:42 UTC (rev 6708) @@ -24,6 +24,14 @@ General: +31Mar08 +kes Remember what volume is in VTLs (previously turned off for + testing). +kes Analysis of JobMedia records by Tom Ivar Helbekkmo <ti...@ha...> + pointed out some problems in creating JobMedia records during + spooling with concurrent jobs. Fix the problem by updating the + start file position before despooling and generate a jobmedia + record at the end of despooling. 28Mar08 kes Fix handling of JobMedia records during spooling and when a Volume is changed without actually writing data to the Volume. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |