]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Make find with no args in tree restore return error rather than
authorKern Sibbald <kern@sibbald.com>
Thu, 31 Aug 2006 21:07:14 +0000 (21:07 +0000)
committerKern Sibbald <kern@sibbald.com>
Thu, 31 Aug 2006 21:07:14 +0000 (21:07 +0000)
     stopping the selection. Fixes bug #665
kes  Rework DVD writing to ensure that the last part is written
     on open_next_part when dealing with a spool file.
kes  Correct the lseek_dev() routine to handle end point correctly
     (bug introduced by me).
kes  Allow part number to exceed num_dvd_parts in lseek_dev().

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3391 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/ReleaseNotes
bacula/src/dird/ua_tree.c
bacula/src/stored/block.c
bacula/src/stored/dev.c
bacula/src/stored/dvd.c
bacula/src/version.h
bacula/technotes-1.39

index 8442a90b363aefefefa7e37024d0d404e839590b..35cd4cdd39670a74ab1e272d4dad6ac6efa51873 100644 (file)
@@ -32,6 +32,22 @@ Fixes for 1.39.20:
 - Eric fixed RunScripts, which I (Kern) had broken in the last beta.
 - Correct Client migration SQL as pointed out by Marc.
 
+==== IMPORTANT =====
+- The database format has been updated from what was used in    
+  Bacula 1.38.x.  You must manually update your database before 
+  running Bacula 1.39.x or higher.  Please backup your previous
+  version of the database before running the update.  The update
+  script will be automatically installed in your scripts directory,
+  or can also be found in <bacula-source>/src/cats.  It is called:
+
+     ./update_bacula_tables
+
+  It is necessary to run it only once the first time you move to a
+  1.39.x beta or to 1.40.0. Upgrading the Bacula version thereafter
+  does not require updating the database again. Depending on the size of your
+  database the script make take a bit of time, to run, but in
+  general, it should be very fast.
+
 New Features in 1.40.0 (beginning of release info)
 - There is a new cross-compiled Win32 File daemon that now has all the features
   that were previously only in the Unix versions.
@@ -68,9 +84,9 @@ New Features in 1.40.0 (beginning of release info)
 Warning for version 1.39.18 and greater:
 - The documentation is almost non-existent for all new features
   except RunScripts (written and documented by Eric Bollengier).
-- If you have an old pre 1.39.18 database, you must upgrade it using
-  the upgrade_bacula_tables script. Please backup your database before
-  upgrading just in case.
+- If you have an old pre 1.39.18 database, you must update it using
+  the update_bacula_tables script. Please backup your database before
+  updating just in case.
 - You *should* be able to use 1.38.x FDs with version 1.39.18 Director
   and SD providing you do not use any of the new features (runscript,   
   data encryption). It seems to work here, but we do not guarantee it.
index 606ad9bbba999df8c4b0c4f5fcfb3d8259c05d45..5c4f30812453126bb3fe72b0b31ff217d189eab1 100644 (file)
@@ -375,7 +375,7 @@ static int findcmd(UAContext *ua, TREE_CTX *tree)
 
    if (ua->argc == 1) {
       bsendmsg(ua, _("No file specification given.\n"));
-      return 0;
+      return 1;      /* make it non-fatal */
    }
 
    for (int i=1; i < ua->argc; i++) {
index 0cf0ea40f2d1b5f0b29f8136cb31f740adc4e530..69f9ab616b15e34f366b976fd6fd211e3fce2e66 100644 (file)
@@ -927,9 +927,11 @@ reread:
    Dmsg3(100, "Tests : %d %d %d\n", (dev->VolCatInfo.VolCatParts > 0), 
          ((dev->file_addr-dev->part_start) == dev->part_size), 
          (dev->part <= dev->VolCatInfo.VolCatParts));*/
+
    /* Check for DVD part file end */
    if (dev->at_eof() && dev->is_dvd() && dev->num_dvd_parts > 0 &&
         dev->part < dev->num_dvd_parts) {
+      Dmsg0(400, "Call dvd_open_next_part\n");
       if (dvd_open_next_part(dcr) < 0) {
          Jmsg3(dcr->jcr, M_FATAL, 0, _("Unable to open device part=%d %s: ERR=%s\n"),
                dev->part, dev->print_name(), dev->bstrerror());
@@ -1096,10 +1098,11 @@ reread:
    if (block->read_len > block->block_len && !dev->is_tape()) {
       char ed1[50];
       off_t pos = lseek_dev(dev, (off_t)0, SEEK_CUR); /* get curr pos */
+      Dmsg1(200, "Current lseek pos=%s\n", edit_int64(pos, ed1));
       pos -= (block->read_len - block->block_len);
       lseek_dev(dev, pos, SEEK_SET);
       Dmsg3(200, "Did lseek pos=%s blk_size=%d rdlen=%d\n", 
-         edit_uint64(pos, ed1), block->block_len,
+         edit_int64(pos, ed1), block->block_len,
             block->read_len);
       dev->file_addr = pos;
       dev->file_size = pos;
index 5ecbe103ca900e97553c76754ec5e41807f783ee..c053980bb33fd0731d734f5e6da3df342497c379 100644 (file)
@@ -653,6 +653,10 @@ bool DEVICE::rewind(DCR *dcr)
    bool first = true;
 
    Dmsg3(400, "rewind res=%d fd=%d %s\n", reserved_device, fd, print_name());
+   state &= ~(ST_EOT|ST_EOF|ST_WEOT);  /* remove EOF/EOT flags */
+   block_num = file = 0;
+   file_size = 0;
+   file_addr = 0;
    if (fd < 0) {
       if (!is_dvd()) { /* In case of major error, the fd is not open on DVD, so we don't want to abort. */
          dev_errno = EBADF;
@@ -662,10 +666,6 @@ bool DEVICE::rewind(DCR *dcr)
       }
       return false;
    }
-   state &= ~(ST_EOT|ST_EOF|ST_WEOT);  /* remove EOF/EOT flags */
-   block_num = file = 0;
-   file_size = 0;
-   file_addr = 0;
    if (is_tape()) {
       mt_com.mt_op = MTREW;
       mt_com.mt_count = 1;
index bb890056fa3f90c5be59dcaf27f141c0ec833be2..3a7bb90c1f764d5d0f2a15bfe896e693d0ebc33d 100644 (file)
@@ -489,10 +489,10 @@ int dvd_open_next_part(DCR *dcr)
    memcpy(&dev->VolCatInfo, &dcr->VolCatInfo, sizeof(dev->VolCatInfo));
    
    /*
-    * If we have a part open for write, then write it to
+    * If we have a spooled part open, write it to the
     *  DVD before opening the next part.
     */
-   if (dev->part > dev->num_dvd_parts && dev->can_append()) {
+   if (dev->is_part_spooled()) {
       Dmsg2(100, "Before open next write previous. part=%d num_parts=%d\n",
          dev->part, dev->num_dvd_parts);
       if (!dvd_write_part(dcr)) {
@@ -606,25 +606,21 @@ off_t lseek_dev(DEVICE *dev, off_t offset, int whence)
    off_t pos;
    char ed1[50], ed2[50];
    
-   Dmsg3(400, "Enter lseek_dev fd=%d part=%d nparts=%d\n", dev->fd,
-      dev->part, dev->num_dvd_parts);
+   Dmsg5(400, "Enter lseek_dev fd=%d off=%s w=%d part=%d nparts=%d\n", dev->fd,
+      edit_int64(offset, ed1), whence, dev->part, dev->num_dvd_parts);
    if (!dev->is_dvd()) { 
       Dmsg0(400, "Using sys lseek\n");
       return lseek(dev->fd, offset, whence);
    }
 
-   /* Return I/O error ... no part */  
-   if (dev->part > dev->num_dvd_parts) {
-      return 0;
-   }
-      
    dcr = (DCR *)dev->attached_dcrs->first();  /* any dcr will do */
    switch(whence) {
    case SEEK_SET:
       Dmsg2(400, "lseek_dev SEEK_SET to %s (part_start=%s)\n",
-         edit_uint64(offset, ed1), edit_uint64(dev->part_start, ed2));
+         edit_int64(offset, ed1), edit_uint64(dev->part_start, ed2));
       if ((uint64_t)offset >= dev->part_start) {
-         if ((uint64_t)offset < dev->part_start+dev->part_size) {
+         if ((uint64_t)offset == dev->part_start || 
+             (uint64_t)offset < dev->part_start+dev->part_size) {
             /* We are staying in the current part, just seek */
             if ((pos = lseek(dev->fd, offset-dev->part_start, SEEK_SET)) < 0) {
                return pos;
@@ -660,20 +656,22 @@ off_t lseek_dev(DEVICE *dev, off_t offset, int whence)
       }
       break;
    case SEEK_CUR:
-      Dmsg1(400, "lseek_dev SEEK_CUR to %s\n", edit_uint64(offset, ed1));
+      Dmsg1(400, "lseek_dev SEEK_CUR to %s\n", edit_int64(offset, ed1));
       if ((pos = lseek(dev->fd, (off_t)0, SEEK_CUR)) < 0) {
-         return pos;   
+         Dmsg0(400, "Seek error.\n");
+         return pos;                  
       }
       pos += dev->part_start;
       if (offset == 0) {
          Dmsg1(400, "lseek_dev SEEK_CUR returns %s\n", edit_uint64(pos, ed1));
          return pos;
-      } else { /* Not used in Bacula, but should work */
+      } else { 
+         Dmsg1(400, "do lseek_dev SEEK_SET %s\n", edit_uint64(pos, ed1));
          return lseek_dev(dev, pos, SEEK_SET);
       }
       break;
    case SEEK_END:
-      Dmsg1(400, "lseek_dev SEEK_END to %s\n", edit_uint64(offset, ed1));
+      Dmsg1(400, "lseek_dev SEEK_END to %s\n", edit_int64(offset, ed1));
       /*
        * Bacula does not use offsets for SEEK_END
        *  Also, Bacula uses seek_end only when it wants to
@@ -728,6 +726,7 @@ off_t lseek_dev(DEVICE *dev, off_t offset, int whence)
       }
       break;
    default:
+      Dmsg0(400, "Seek call error.\n");
       errno = EINVAL;
       return -1;
    }
index 26fd4d6d89e10b892c132b62f988ae6732839126..b5a461f1b6296228fc8895d72511006417480041 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "1.39.21"
-#define BDATE   "30 August 2006"
-#define LSMDATE "30Aug06"
+#define BDATE   "31 August 2006"
+#define LSMDATE "31Aug06"
 #define BYEAR "2006"       /* year for copyright messages in progs */
 
 /* Debug flags */
index bc9f422490b7f45fdc04395162bfd2e7392eb467..d4e5056b1e469f3556c1e362a856960d8d4ef611 100644 (file)
@@ -1,6 +1,14 @@
               Technical notes on version 1.39  
 
 General:
+31Aug06
+kes  Make find with no args in tree restore return error rather than
+     stopping the selection. Fixes bug #665
+kes  Rework DVD writing to ensure that the last part is written
+     on open_next_part when dealing with a spool file.
+kes  Correct the lseek_dev() routine to handle end point correctly
+     (bug introduced by me).
+kes  Allow part number to exceed num_dvd_parts in lseek_dev().
 30Aug06
 kes  Apply dvd-handler patch from Richard Mortimer.                        
 kes  Apply dvd error check patch from Richard Mortimer.