]> git.sur5r.net Git - bacula/bacula/commitdiff
Implement block rejection during read
authorKern Sibbald <kern@sibbald.com>
Fri, 20 Jun 2003 15:24:49 +0000 (15:24 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 20 Jun 2003 15:24:49 +0000 (15:24 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@596 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/ChangeLog
bacula/ReleaseNotes
bacula/kernstodo
bacula/src/stored/bls.c
bacula/src/stored/bsr.h
bacula/src/stored/match_bsr.c
bacula/src/stored/parse_bsr.c
bacula/src/stored/protos.h
bacula/src/stored/read.c
bacula/src/stored/read_record.c
bacula/src/version.h

index ee4e68f5deb9f1ac05e2b95611b0b9c5ddd5c2e9..03b17e22c4e87ebb21171aa0953f16f951a4e2a6 100644 (file)
@@ -1,3 +1,47 @@
+2003-xx-xx Version 1.31 Beta xxJun03
+- Very preliminary support for Gnome-2.0.  Text does not yet work.
+- Correct buffer corruption in find_one.c with long directory names (Win32).
+- Make setting owner on directories M_ERROR rather than M_WARNING.
+- Fix printing of JobId in run listing for restore job.
+- Reduce heartbeat read check interval to every 10 seconds on Cygwin because
+  there is no working pthread_kill().
+- I finally designed a test for multiple simultaneous jobs,
+  and sure enough it broke when the jobs are split over multiple
+  volumes.  Now fixed and working!
+- Eliminated a few "duplicate" error messages by testing for canceled.
+- Add ASSERT for device use count going negative.
+- Fix BlockNumber checking in stored/read.c (got first one wrong).
+- If socket is timed out, do a shutdown(fd,2) instead of close().
+- Fixed return status from SD to FD by setting JobStatus in append_end() 
+- Add arrays to Environment variables. Elements separated by |.
+- Implement Reschedule On Error, Reschedule Interval, Reschedule Times.
+- Add a new pool PM_NAME -- gets a name length buffer.
+- Implement fast cancel of FD blocked on writing to SD by using
+  pthread_cancel(). Turned off on Cygwin due to bug.
+- Add code to handle EAGAIN in writing (probably not necessary). Use
+  select().
+- Eliminate size_t from pool control buffers.
+- Complete Counter resource.
+- Complete LabelFormat (except for WrapCounter) plus counter
+  inrementation.
+- This needs a database change to eliminate PoolId from counters.
+- Made a more compact format for the document index.
+- Add Phil's checkhost to examples directory (thanks Phil).
+- Implement generalized LabelFormat (documentation to come).
+- Implement Counter resource.
+- Cleanup examples/kernsconfig
+- Implement restore to a specific date.
+- Fixed a but in automatic labeling (and use durations expiring) analysed
+  and reported by Rob Proffitt (thanks!).
+- Cleaned up a few Cygwin compile problems.
+- Made a 10Jun03 release (it is in production here)
+- Finally took the big plunge and fixed restoration of links and other
+  files that have been changed between the backup and restore. Basically
+  if the file exists, it is deleted, then re-created.
+- Purge only Volumes marked Append, Full, Used, or Error.
+- Allow pruning of volumes marked Append, in addition to Full and Used.
+
+
 2003-06-10 Version 1.31 Beta 10Jun03
 - Eliminated all plain email addresses and replaced them with " at " in
   place of @ to reduce havesting by spammers.  Doc + Web Site.
index 6aa7421e133a6b45ab194039c02f2b8285bd26fa..a2bfbb5e4d164433d37fe0e28ebd375f5bb90a8e 100644 (file)
@@ -1,7 +1,7 @@
 
           Release Notes for Bacula 1.31
 
-  Bacula code: Total files = 250 Total lines = 74,359 (*.h *.c *.in)
+  Bacula code: Total files = 250 Total lines = 74,376 (*.h *.c *.in)
 
 Major Changes this Release:
 - The database format has changed. Please see below.
@@ -16,10 +16,15 @@ Major Changes this Release:
 - Added readline to depkgs (removed from depkgs1) and fixed configuration if
   it is not installed in your system libraries.
 - Implemented generalized tape label formats including counter variables.
-- Implement multiple simultaneous jobs.
+- Multiple simultaneous jobs now work.
+- Implemented tape block rejection, which means that restores with
+  several incremental backups will run orders of magnitude faster.
 
 
 Other Changes this Release:
+- During a normal restore (replace = yes), any existing file is deleted
+  and the restored file is then created. This corrects links and other
+  wierd files that changed between the backup and the restore.
 - Preliminary support for BSDi.
 - Use smtp instead of mail to send the traceback message.
 - Fixed a race condition in the "list" command while a backup is
@@ -27,7 +32,7 @@ Other Changes this Release:
 - Beginning of support for SSL encryption.
 - Beggining of support for Base level backups.
 - Improvements to gnome-console.
-- Prune certain orphaned jobs (no files saved, no Volume used).
+- Prune orphaned jobs (no files saved, no Volume used).
 - Added non-fatal errors to Job reports.
 - Eliminate need for SubsysDirectory in each daemon -- please remove
   these records from your .conf files.
@@ -36,16 +41,19 @@ Other Changes this Release:
 - Better handling of errors with autochangers during restore.
 - Better cancellation of jobs in Storage daemon (doesn't try
   to cleanup twice).
+- Better cancellation of File daemon (except on Cygwin systems).
 - SD error messages such as autochanger errors are now properly
   directed back to Console -- previously some were lost.
-- A Storage daemon crash on FreeBSD systems (due to an improper FreeBSD
-  pthreads implementation -- IMO) is fixed.
+- A Storage daemon crash on FreeBSD systems (due to a different FreeBSD
+  pthreads implementation) is fixed.
 - Better Job termination report particularly for Verify and Restore jobs.
 - Update Verify VolumeToCatalog to use new BSR records.
 - Fixed list last 20 jobs in restore command (previously reported any 
   20 jobs).
 - Gnome command line history works better.
 - Better messages if a job is upgraded from Diff or Inc to Full.
+- Replaced FileSet MD5 with date created -- more aestetic and readable.
+- Fixed a FD crash on long directory names (Win32 specific).
 
 
 
index 315151e48829abd812ad0833ef9acea5596a0abc..e439223e4c3d80df51cfb970138f0697e8c36197 100644 (file)
@@ -31,6 +31,9 @@ Testing to do: (painful)
 - Figure out how to use ssh or stunnel to protect Bacula communications.
 
 For 1.31 release:
+- Implement fast block rejection: match_bsr_block().
+- Implement forward spacing block/file: position_device(bsr) --
+  just before read_block_from_device();
 - On Windows with very long path names, it may be impossible to create 
   a file (and thus restore it) because the total length is too long.
   We must cd into the directory then create the file without the
index 9f55aebedaacdd0d9cb4edd820c0d791f41a63e5..f16723cfe96a9cb3d557e7549278d8f8bac4695a 100644 (file)
@@ -275,6 +275,12 @@ static void do_blocks(char *infname)
            break;
         }
       }
+      if (!match_bsr_block(bsr, block)) {
+         Dmsg5(100, "reject Blk=%u blen=%u bVer=%d SessId=%u SessTim=%u\n",
+           block->BlockNumber, block->block_len, block->BlockVer,
+           block->VolSessionId, block->VolSessionTime);
+        continue;
+      }
       Dmsg5(100, "Blk=%u blen=%u bVer=%d SessId=%u SessTim=%u\n",
         block->BlockNumber, block->block_len, block->BlockVer,
         block->VolSessionId, block->VolSessionTime);
index 8dcaf57f0eb2d360d307b66201cf5cc2de6c4054..780ca3d0375b7d34e73453880ed5d8cf9c50c996 100644 (file)
@@ -65,27 +65,26 @@ struct BSR_SESSID {
    BSR_SESSID *next;
    uint32_t sessid;
    uint32_t sessid2;
-   int done;                          /* local done */
 };
 
 struct BSR_SESSTIME {
    BSR_SESSTIME *next;
    uint32_t sesstime;
-   int done;                          /* local done */
+   bool done;                         /* local done */
 };             
 
 struct BSR_VOLFILE {
    BSR_VOLFILE *next;
    uint32_t sfile;                    /* start file */
    uint32_t efile;                    /* end file */
-   int done;                          /* local done */
+   bool done;                         /* local done */
 };
 
 struct BSR_VOLBLOCK {
    BSR_VOLBLOCK *next;
    uint32_t sblock;                   /* start block */
    uint32_t eblock;                   /* end block */
-   int done;                          /* local done */
+   bool done;                         /* local done */
 };             
 
 
@@ -93,7 +92,7 @@ struct BSR_FINDEX {
    BSR_FINDEX *next;
    int32_t findex;                    /* start file index */
    int32_t findex2;                   /* end file index */
-   int done;                          /* local done */
+   bool done;                         /* local done */
 };           
 
 struct BSR_JOBID {
@@ -115,7 +114,7 @@ struct BSR_JOBLEVEL {
 struct BSR_JOB {
    BSR_JOB *next;
    char Job[MAX_NAME_LENGTH];
-   int done;
+   bool done;                         /* local done */
 };
 
 struct BSR_STREAM {
@@ -125,7 +124,9 @@ struct BSR_STREAM {
 
 struct BSR {
    BSR          *next;                /* pointer to next one */
-   int           done;                /* set when everything found */
+   bool          done;                /* set when everything found */
+   bool          use_fast_rejection;  /* set if fast rejection can be used */
+   bool          use_positioning;     /* set if we can position the archive */
    BSR_VOLUME   *volume;
    int32_t       Slot;                /* Slot */
    uint32_t      count;               /* count of files to restore this bsr */
index 3b6d0f6f47c930ef3da752f3696862a0fced7816..95fed69776de4b1a80d308b8937558f18cbe5ff1 100755 (executable)
@@ -8,7 +8,7 @@
  */
 
 /*
-   Copyright (C) 2002 Kern Sibbald and John Walker
+   Copyright (C) 2000-2003 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
 
  */
 
-
 #include "bacula.h"
 #include "stored.h"
 #include <fnmatch.h>
 
 /* Forward references */
-static int match_volume(BSR *bsr, BSR_VOLUME *volume, VOLUME_LABEL *volrec, int done);
-static int match_sesstime(BSR *bsr, BSR_SESSTIME *sesstime, DEV_RECORD *rec, int done);
-static int match_sessid(BSR *bsr, BSR_SESSID *sessid, DEV_RECORD *rec, int done);
-static int match_client(BSR *bsr, BSR_CLIENT *client, SESSION_LABEL *sessrec, int done);
-static int match_job(BSR *bsr, BSR_JOB *job, SESSION_LABEL *sessrec, int done);
-static int match_job_type(BSR *bsr, BSR_JOBTYPE *job_type, SESSION_LABEL *sessrec, int done);
-static int match_job_level(BSR *bsr, BSR_JOBLEVEL *job_level, SESSION_LABEL *sessrec, int done);
-static int match_jobid(BSR *bsr, BSR_JOBID *jobid, SESSION_LABEL *sessrec, int done);
-static int match_findex(BSR *bsr, BSR_FINDEX *findex, DEV_RECORD *rec, int done);
-static int match_volfile(BSR *bsr, BSR_VOLFILE *volfile, DEV_RECORD *rec, int done);
-static int match_stream(BSR *bsr, BSR_STREAM *stream, DEV_RECORD *rec, int done);
-static int match_all(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, SESSION_LABEL *sessrec, int done);
+static int match_volume(BSR *bsr, BSR_VOLUME *volume, VOLUME_LABEL *volrec, bool done);
+static int match_sesstime(BSR *bsr, BSR_SESSTIME *sesstime, DEV_RECORD *rec, bool done);
+static int match_sessid(BSR *bsr, BSR_SESSID *sessid, DEV_RECORD *rec);
+static int match_client(BSR *bsr, BSR_CLIENT *client, SESSION_LABEL *sessrec, bool done);
+static int match_job(BSR *bsr, BSR_JOB *job, SESSION_LABEL *sessrec, bool done);
+static int match_job_type(BSR *bsr, BSR_JOBTYPE *job_type, SESSION_LABEL *sessrec, bool done);
+static int match_job_level(BSR *bsr, BSR_JOBLEVEL *job_level, SESSION_LABEL *sessrec, bool done);
+static int match_jobid(BSR *bsr, BSR_JOBID *jobid, SESSION_LABEL *sessrec, bool done);
+static int match_findex(BSR *bsr, BSR_FINDEX *findex, DEV_RECORD *rec, bool done);
+static int match_volfile(BSR *bsr, BSR_VOLFILE *volfile, DEV_RECORD *rec, bool done);
+static int match_stream(BSR *bsr, BSR_STREAM *stream, DEV_RECORD *rec, bool done);
+static int match_all(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, SESSION_LABEL *sessrec, bool done);
+static int match_block_sesstime(BSR *bsr, BSR_SESSTIME *sesstime, DEV_BLOCK *block);
+static int match_block_sessid(BSR *bsr, BSR_SESSID *sessid, DEV_BLOCK *block);
+
+/*********************************************************************
+ *
+ *  If possible, position the archive device (tape) to read the
+ *  next block.
+ */
+void position_bsr_block(BSR *bsr, DEV_BLOCK *block)
+{
+   /* To be implemented */
+}
+
+/*********************************************************************
+ *
+ *  Do fast block rejection based on bootstrap records. 
+ *    use_fast_rejection will be set if we have VolSessionId and VolSessTime
+ *    in each record. When BlockVer is >= 2, we have those in the block header
+ *    so can do fast rejection.
+ *
+ *   returns:  1 if block may contain valid records
+ *            0 if block may be skipped (i.e. it contains no records of
+ *                 that can match the bsr).
+ *
+ */
+int match_bsr_block(BSR *bsr, DEV_BLOCK *block)
+{
+   if (!bsr || !bsr->use_fast_rejection || (block->BlockVer < 2)) {
+      return 1;                      /* cannot fast reject */
+   }
+
+   if (match_block_sesstime(bsr, bsr->sesstime, block)) {
+      return 1;
+   }
+   return match_block_sessid(bsr, bsr->sessid, block);
+}
+
+static int match_block_sesstime(BSR *bsr, BSR_SESSTIME *sesstime, DEV_BLOCK *block)
+{
+   if (!sesstime) {
+      return 1;                      /* no specification matches all */
+   }
+   if (sesstime->sesstime == block->VolSessionTime) {
+      return 1;
+   }
+   if (sesstime->next) {
+      return match_block_sesstime(bsr, sesstime->next, block);
+   }
+   return 0;
+}
+
+static int match_block_sessid(BSR *bsr, BSR_SESSID *sessid, DEV_BLOCK *block)
+{
+   if (!sessid) {
+      return 1;                      /* no specification matches all */
+   }
+   if (sessid->sessid <= block->VolSessionId && sessid->sessid2 >= block->VolSessionId) {
+      return 1;
+   }
+   if (sessid->next) {
+      return match_block_sessid(bsr, sessid->next, block);
+   }
+   return 0;
+}
+
 
 /*********************************************************************
  *
@@ -58,7 +122,7 @@ int match_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, SESSION_LABEL *se
    int stat;
 
    if (bsr) {
-      stat = match_all(bsr, rec, volrec, sessrec, 1);
+      stat = match_all(bsr, rec, volrec, sessrec, true);
    } else {
       stat = 0;
    }
@@ -73,13 +137,13 @@ int match_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, SESSION_LABEL *se
  *   returns -1 no additional matches possible
  */
 static int match_all(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, 
-                    SESSION_LABEL *sessrec, int done)
+                    SESSION_LABEL *sessrec, bool done)
 {
    if (bsr->done) {
       goto no_match;
    }
    if (bsr->count && bsr->count <= bsr->found) {
-      bsr->done = 1;
+      bsr->done = true;
       goto no_match;
    }
    if (!match_volume(bsr, bsr->volume, volrec, 1)) {
@@ -93,7 +157,7 @@ static int match_all(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec,
    }
 
    /* NOTE!! This test MUST come after the sesstime test */
-   if (!match_sessid(bsr, bsr->sessid, rec, 1)) {
+   if (!match_sessid(bsr, bsr->sessid, rec)) {
       goto no_match;
    }
 
@@ -132,7 +196,7 @@ no_match:
    return 0;
 }
 
-static int match_volume(BSR *bsr, BSR_VOLUME *volume, VOLUME_LABEL *volrec, int done) 
+static int match_volume(BSR *bsr, BSR_VOLUME *volume, VOLUME_LABEL *volrec, bool done) 
 {
    if (!volume) {
       return 0;                      /* Volume must match */
@@ -146,7 +210,7 @@ static int match_volume(BSR *bsr, BSR_VOLUME *volume, VOLUME_LABEL *volrec, int
    return 0;
 }
 
-static int match_client(BSR *bsr, BSR_CLIENT *client, SESSION_LABEL *sessrec, int done)
+static int match_client(BSR *bsr, BSR_CLIENT *client, SESSION_LABEL *sessrec, bool done)
 {
    if (!client) {
       return 1;                      /* no specification matches all */
@@ -160,7 +224,7 @@ static int match_client(BSR *bsr, BSR_CLIENT *client, SESSION_LABEL *sessrec, in
    return 0;
 }
 
-static int match_job(BSR *bsr, BSR_JOB *job, SESSION_LABEL *sessrec, int done)
+static int match_job(BSR *bsr, BSR_JOB *job, SESSION_LABEL *sessrec, bool done)
 {
    if (!job) {
       return 1;                      /* no specification matches all */
@@ -174,7 +238,7 @@ static int match_job(BSR *bsr, BSR_JOB *job, SESSION_LABEL *sessrec, int done)
    return 0;
 }
 
-static int match_job_type(BSR *bsr, BSR_JOBTYPE *job_type, SESSION_LABEL *sessrec, int done)
+static int match_job_type(BSR *bsr, BSR_JOBTYPE *job_type, SESSION_LABEL *sessrec, bool done)
 {
    if (!job_type) {
       return 1;                      /* no specification matches all */
@@ -188,7 +252,7 @@ static int match_job_type(BSR *bsr, BSR_JOBTYPE *job_type, SESSION_LABEL *sessre
    return 0;
 }
 
-static int match_job_level(BSR *bsr, BSR_JOBLEVEL *job_level, SESSION_LABEL *sessrec, int done)
+static int match_job_level(BSR *bsr, BSR_JOBLEVEL *job_level, SESSION_LABEL *sessrec, bool done)
 {
    if (!job_level) {
       return 1;                      /* no specification matches all */
@@ -202,7 +266,7 @@ static int match_job_level(BSR *bsr, BSR_JOBLEVEL *job_level, SESSION_LABEL *ses
    return 0;
 }
 
-static int match_jobid(BSR *bsr, BSR_JOBID *jobid, SESSION_LABEL *sessrec, int done)
+static int match_jobid(BSR *bsr, BSR_JOBID *jobid, SESSION_LABEL *sessrec, bool done)
 {
    if (!jobid) {
       return 1;                      /* no specification matches all */
@@ -216,7 +280,7 @@ static int match_jobid(BSR *bsr, BSR_JOBID *jobid, SESSION_LABEL *sessrec, int d
    return 0;
 }
 
-static int match_volfile(BSR *bsr, BSR_VOLFILE *volfile, DEV_RECORD *rec, int done)
+static int match_volfile(BSR *bsr, BSR_VOLFILE *volfile, DEV_RECORD *rec, bool done)
 {
    if (!volfile) {
       return 1;                      /* no specification matches all */
@@ -232,7 +296,7 @@ static int match_volfile(BSR *bsr, BSR_VOLFILE *volfile, DEV_RECORD *rec, int do
    }
    /* Once we get past last efile, we are done */
    if (rec->File > volfile->efile) {
-      volfile->done = 1;             /* set local done */
+      volfile->done = true;             /* set local done */
    }
    if (volfile->next) {
       return match_volfile(bsr, volfile->next, rec, volfile->done && done);
@@ -240,12 +304,12 @@ static int match_volfile(BSR *bsr, BSR_VOLFILE *volfile, DEV_RECORD *rec, int do
 
    /* If we are done and all prior matches are done, this bsr is finished */
    if (volfile->done && done) {
-      bsr->done = 1;
+      bsr->done = true;
    }
    return 0;
 }
 
-static int match_stream(BSR *bsr, BSR_STREAM *stream, DEV_RECORD *rec, int done)
+static int match_stream(BSR *bsr, BSR_STREAM *stream, DEV_RECORD *rec, bool done)
 {
    if (!stream) {
       return 1;                      /* no specification matches all */
@@ -259,7 +323,7 @@ static int match_stream(BSR *bsr, BSR_STREAM *stream, DEV_RECORD *rec, int done)
    return 0;
 }
 
-static int match_sesstime(BSR *bsr, BSR_SESSTIME *sesstime, DEV_RECORD *rec, int done)
+static int match_sesstime(BSR *bsr, BSR_SESSTIME *sesstime, DEV_RECORD *rec, bool done)
 {
    if (!sesstime) {
       return 1;                      /* no specification matches all */
@@ -268,18 +332,18 @@ static int match_sesstime(BSR *bsr, BSR_SESSTIME *sesstime, DEV_RECORD *rec, int
       return 1;
    }
    if (rec->VolSessionTime > sesstime->sesstime) {
-      sesstime->done = 1;
+      sesstime->done = true;
    }
    if (sesstime->next) {
       return match_sesstime(bsr, sesstime->next, rec, sesstime->done && done);
    }
    if (sesstime->done && done) {
-      bsr->done = 1;
+      bsr->done = true;
    }
    return 0;
 }
 
-static int match_sessid(BSR *bsr, BSR_SESSID *sessid, DEV_RECORD *rec, int done)
+static int match_sessid(BSR *bsr, BSR_SESSID *sessid, DEV_RECORD *rec)
 {
    if (!sessid) {
       return 1;                      /* no specification matches all */
@@ -288,15 +352,12 @@ static int match_sessid(BSR *bsr, BSR_SESSID *sessid, DEV_RECORD *rec, int done)
       return 1;
    }
    if (sessid->next) {
-      return match_sessid(bsr, sessid->next, rec, sessid->done && done);
-   }
-   if (sessid->done && done) {
-      bsr->done = 1;
+      return match_sessid(bsr, sessid->next, rec);
    }
    return 0;
 }
 
-static int match_findex(BSR *bsr, BSR_FINDEX *findex, DEV_RECORD *rec, int done)
+static int match_findex(BSR *bsr, BSR_FINDEX *findex, DEV_RECORD *rec, bool done)
 {
    if (!findex) {
       return 1;                      /* no specification matches all */
@@ -305,13 +366,13 @@ static int match_findex(BSR *bsr, BSR_FINDEX *findex, DEV_RECORD *rec, int done)
       return 1;
    }
    if (rec->FileIndex > findex->findex2) {
-      findex->done = 1;
+      findex->done = true;
    }
    if (findex->next) {
       return match_findex(bsr, findex->next, rec, findex->done && done);
    }
    if (findex->done && done) {
-      bsr->done = 1;
+      bsr->done = true;
    }
    return 0;
 }
index 73e76e16e9ac92dee5cae91d35472d5ca1381b1a..6526424567dc19939761d34532cdd7aab08cae6b 100755 (executable)
@@ -47,6 +47,7 @@ static BSR *store_include(LEX *lc, BSR *bsr);
 static BSR *store_exclude(LEX *lc, BSR *bsr);
 static BSR *store_stream(LEX *lc, BSR *bsr);
 static BSR *store_slot(LEX *lc, BSR *bsr);
+static bool is_fast_rejection_ok(BSR *bsr);
 
 struct kw_items {
    char *name;
@@ -164,9 +165,28 @@ BSR *parse_bsr(JCR *jcr, char *cf)
       free_bsr(root_bsr);
       root_bsr = NULL;
    }
+   if (root_bsr) {
+      root_bsr->use_fast_rejection = is_fast_rejection_ok(root_bsr);
+   }
    return root_bsr;
 }
 
+static bool is_fast_rejection_ok(BSR *bsr)
+{
+   /*
+    * Although, this can be optimized, for the moment, require
+    *  all bsrs to have both sesstime and sessid set before
+    *  we do fast rejection.
+    */
+   if (!(bsr->sesstime && bsr->sessid)) {
+      return false;
+   }
+   if (bsr->next) {
+      return is_fast_rejection_ok(bsr->next);
+   }
+   return true;
+}
+
 static BSR *store_vol(LEX *lc, BSR *bsr)
 {
    int token;
index 644a37494aba328ce38fa155006d96528f690191..107d2d2cc3cf73962744b99b98be0d9e4e289cf7 100644 (file)
@@ -148,6 +148,8 @@ int  unser_session_label(SESSION_LABEL *label, DEV_RECORD *rec);
 /* From match_bsr.c */
 int match_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, 
              SESSION_LABEL *sesrec);
+int match_bsr_block(BSR *bsr, DEV_BLOCK *block);
+void position_bsr_block(BSR *bsr, DEV_BLOCK *block);
 
 /* From mount.c */
 int     mount_next_write_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, int release);
index 45d89aebd152dd24df7c277a0b038053d90a42f4..b47362e48a6ff8d97466ca71de119809fea4f5c9 100644 (file)
@@ -141,6 +141,14 @@ int do_read_data(JCR *jcr)
         }
       }
 
+      if (!block_is_empty(block) && !match_bsr_block(jcr->bsr, block)) {
+         Dmsg5(100, "reject Blk=%u blen=%u bVer=%d SessId=%u SessTim=%u\n",
+           block->BlockNumber, block->block_len, block->BlockVer,
+           block->VolSessionId, block->VolSessionTime);
+        empty_block(block);          /* force read next block */
+        continue;
+      }
+
       for (rec->state=0; !is_block_empty(rec); ) {
 
         if (!read_record_from_block(block, rec)) {
index a3c8858b5d4eba1ecd407a102d743250607deb7d..92930f15629bb334f6d3acbf51dc2267d997ead7 100644 (file)
@@ -111,6 +111,12 @@ int read_records(JCR *jcr,  DEVICE *dev,
            break;
         }
       }
+      if (!match_bsr_block(jcr->bsr, block)) {
+         Dmsg5(100, "reject Blk=%u blen=%u bVer=%d SessId=%u SessTim=%u\n",
+           block->BlockNumber, block->block_len, block->BlockVer,
+           block->VolSessionId, block->VolSessionTime);
+        continue;
+      }
       if (verbose) {
          Dmsg4(000, "Block: %d VI=%u VT=%u blen=%d\n", block->BlockNumber, 
            block->VolSessionId, block->VolSessionTime, block->block_len);
index 1f79bbf30e55842d220a6021ae9dc33ae1428e3c..d3d5656088411e17851f954dfd40a31639d9e8ae 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #define VERSION "1.31"
 #define VSTRING "1"
-#define BDATE   "18 Jun 2003"
-#define LSMDATE "18Jun03"
+#define BDATE   "20 Jun 2003"
+#define LSMDATE "20Jun03"
 
 /* Debug flags */
 #define DEBUG 1