]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Implement code that should properly set that a job was migrated,
authorKern Sibbald <kern@sibbald.com>
Wed, 13 Dec 2006 19:42:12 +0000 (19:42 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 13 Dec 2006 19:42:12 +0000 (19:42 +0000)
     if the migration was successful even if there were no file to
     migrate.
kes  Apply Richard's patch to fix building or filed/restore.c without
     OpenSSL support.
kes  Ensure that at least one block is written by the SD even if the
     FD dies or fails -- should fix bug #728.
kes  Convert stored/record.c ASSERT into a soft fail if the length of
     a record is too insanely long. This should fix bug #???

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

12 files changed:
bacula/kernstodo
bacula/projects
bacula/src/dird/migrate.c
bacula/src/filed/restore.c
bacula/src/stored/append.c
bacula/src/stored/bls.c
bacula/src/stored/btape.c
bacula/src/stored/label.c
bacula/src/stored/protos.h
bacula/src/stored/read_record.c
bacula/src/stored/record.c
bacula/technotes-1.39

index 9729fb87229a5cd87c2fd672567e168ca7482272..8a541ed63c471f0847cf1963d7a62a7d60ec6135 100644 (file)
@@ -61,6 +61,8 @@ Priority:
 
 
 For 1.39:
+- Fix hardlinked immutable files when linking a second file, the
+  immutable flag must be removed prior to trying to link it.
 - Implement Python event for backing up/restoring a file.
 - Change dbcheck to tell users to use native tools for fixing
   broken databases, and to ensure they have the proper indexes.
@@ -1750,4 +1752,3 @@ Block Position: 0
   example conf files (especially in the manual).
 - Fix prog copyright (SD) all other files.
 - Document need for UTF-8 format
-
index 4dd5f76505bc2516fc5ad02316c0d310c2e5d6f8..723f0593d05a9ca42252bdeb3debd3a33c6b832a 100644 (file)
@@ -1193,3 +1193,29 @@ Notes:
         functionality is the ultimate goal.
 
         Assistance with either code or testing would be fantastic.
+
+Item 1: On the bconsole "restore" command line, implement separate
+           option for specifying the host to restore from, and the 
+           host to restore to.
+           
+   Date: 11 December 2006
+   
+   Origin: Discussion on Bacula-users entitled 'Scripted restores to
+           different clients', December 2006 
+           
+   Status: New feature request
+   What: While using bconsole interactively, you can specify the client
+           that a backup job is to be restored for, and then you can
+           specify later a different client to send the restored files
+           back to. However, using the 'restore' command with all options
+           on the command line, this cannot be done, due to the ambiguous
+           'client' parameter. Additionally, this parameter means different
+           things depending on if it's specified on the command line or
+           afterwards, in the Modify Job screens.
+   Why: This feature would enable restore jobs to be more completely
+           automated, for example by a web or GUI front-end.
+   Notes: client can also be implied by specifying the jobid on the command
+           line
index ee827237f15561b6ab2123ef5af065b81aa19b1e..991b581312d6f74307d9f6e955b52364aa7ebd63 100644 (file)
@@ -1090,6 +1090,12 @@ void migration_cleanup(JCR *jcr, int TermCode)
          break;
       }
   } else {
+     if (jcr->previous_jr.JobId != 0) {
+        /* Mark previous job as migrated */
+        Mmsg(query, "UPDATE Job SET Type='%c' WHERE JobId=%s",
+             (char)JT_MIGRATED_JOB, edit_uint64(jcr->previous_jr.JobId, ec1));
+        db_sql_query(jcr->db, query.c_str(), NULL, NULL);
+     }
      term_msg = _("%s -- no files to migrate");
   }
 
index 142bd40a39cdc0925c0906eefe2d4827ae5a93fb..846efa4e225e84c0cd364ce331b2a86ad92e2821 100644 (file)
@@ -188,16 +188,19 @@ void do_restore(JCR *jcr)
       jcr->compress_buf_size = compress_buf_size;
    }
 
+   cipher_ctx.cipher = NULL;
+   alt_cipher_ctx.cipher = NULL;
    if (have_crypto) {
-      cipher_ctx.cipher = NULL;
       cipher_ctx.buf = get_memory(CRYPTO_CIPHER_MAX_BLOCK_SIZE);
       cipher_ctx.buf_len = 0;
       cipher_ctx.packet_len = 0;
 
-      cipher_ctx.cipher = NULL;
       alt_cipher_ctx.buf = get_memory(CRYPTO_CIPHER_MAX_BLOCK_SIZE);
       alt_cipher_ctx.buf_len = 0;
       alt_cipher_ctx.packet_len = 0;
+   } else {
+      cipher_ctx.buf = NULL;
+      alt_cipher_ctx.buf = NULL;
    }
    
    /*
index 1e5b5f91ffce0f46a6e674a7b3fb3ad2308029ab..7985e594e3f9dec33f4709c460e0a6a9e9a01256 100644 (file)
@@ -278,10 +278,10 @@ bool do_append_data(JCR *jcr)
    Dmsg1(200, "Write EOS label JobStatus=%c\n", jcr->JobStatus);
 
    /*
-    * If !OK, check if we can still write. This may not be the case
+    * Check if we can still write. This may not be the case
     *  if we are at the end of the tape or we got a fatal I/O error.
     */
-   if (ok || dev->can_write()) {
+   if (dev->can_write()) {
       if (!write_session_label(dcr, EOS_LABEL)) {
          Jmsg1(jcr, M_FATAL, 0, _("Error writting end session label. ERR=%s\n"),
                dev->bstrerror());
index caebdc9b0e2db9d92c671e75f1947ea0da27fb2d..94cc2bf2bdba22aad3c405094d3db1a7af1b4854 100644 (file)
@@ -284,7 +284,7 @@ static void do_blocks(char *infname)
             DEV_RECORD *record;
             record = new_record();
             read_block_from_device(dcr, NO_BLOCK_NUMBER_CHECK);
-            read_record_from_block(block, record);
+            read_record_from_block(dcr, block, record);
             get_session_record(dev, record, &sessrec);
             free_record(record);
             Jmsg(jcr, M_INFO, 0, _("Mounted Volume \"%s\".\n"), dcr->VolumeName);
@@ -312,7 +312,7 @@ static void do_blocks(char *infname)
         block->BlockNumber, block->block_len, block->BlockVer,
         block->VolSessionId, block->VolSessionTime);
       if (verbose == 1) {
-         read_record_from_block(block, rec);
+         read_record_from_block(dcr, block, rec);
          Pmsg9(-1, _("File:blk=%u:%u blk_num=%u blen=%u First rec FI=%s SessId=%u SessTim=%u Strm=%s rlen=%d\n"),
               dev->file, dev->block_num,
               block->BlockNumber, block->block_len,
index 4c7a7c5bbc5058a23fa10edb3b698c7316eef79a..2f64288fb67ca514a3ede38f763cf281c13ac583 100644 (file)
@@ -751,7 +751,7 @@ static int re_read_block_test()
       goto bail_out;
    }
    memset(rec->data, 0, rec->data_len);
-   if (!read_record_from_block(block, rec)) {
+   if (!read_record_from_block(dcr, block, rec)) {
       berrno be;
       Pmsg1(0, _("Read block failed! ERR=%s\n"), be.strerror(dev->dev_errno));
       goto bail_out;
@@ -863,7 +863,7 @@ read_again:
          goto bail_out;
       }
       memset(rec->data, 0, rec->data_len);
-      if (!read_record_from_block(block, rec)) {
+      if (!read_record_from_block(dcr, block, rec)) {
          berrno be;
          Pmsg2(0, _("Read record failed. Block %d! ERR=%s\n"), i, be.strerror(dev->dev_errno));
          goto bail_out;
@@ -1030,7 +1030,7 @@ read_again:
          goto bail_out;
       }
       memset(rec->data, 0, rec->data_len);
-      if (!read_record_from_block(block, rec)) {
+      if (!read_record_from_block(dcr, block, rec)) {
          berrno be;
          Pmsg1(0, _("Read record failed! ERR=%s\n"), be.strerror(dev->dev_errno));
          goto bail_out;
@@ -1773,7 +1773,7 @@ static void scan_blocks()
          block->VolSessionId, block->VolSessionTime);
       if (verbose == 1) {
          DEV_RECORD *rec = new_record();
-         read_record_from_block(block, rec);
+         read_record_from_block(dcr, block, rec);
          Pmsg8(-1, _("Blk_block: %u dev_blk=%u blen=%u First rec FI=%s SessId=%u SessTim=%u Strm=%s rlen=%d\n"),
               block->BlockNumber, dev->block_num, block->block_len,
               FI_to_ascii(buf1, rec->FileIndex), rec->VolSessionId, rec->VolSessionTime,
index d997f234610abe28be33f70b5847daef5166ed53..26db7b941dd01ddb17b19e695a21beafe9dc2ffb 100644 (file)
@@ -153,7 +153,7 @@ int read_dev_volume_label(DCR *dcr)
            "labeled Volume, because: ERR=%s"), NPRT(VolName), 
            dev->print_name(), dev->print_errmsg());
       Dmsg1(30, "%s", jcr->errmsg);
-   } else if (!read_record_from_block(block, record)) {
+   } else if (!read_record_from_block(dcr, block, record)) {
       Mmsg(jcr->errmsg, _("Could not read Volume label from block.\n"));
       Dmsg1(30, "%s", jcr->errmsg);
    } else if (!unser_volume_label(dev, record)) {
index 8227166610138a64b4b25921a269e3f4305ceae9..2e3bbdf3a84ede3ba5b3f3adb9398c6ec207f15b 100644 (file)
@@ -198,7 +198,7 @@ const char *FI_to_ascii(char *buf, int fi);
 const char *stream_to_ascii(char *buf, int stream, int fi);
 bool        write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
 bool        can_write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec);
-bool        read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec);
+bool        read_record_from_block(DCR *dcr, DEV_BLOCK *block, DEV_RECORD *rec);
 DEV_RECORD *new_record();
 void        free_record(DEV_RECORD *rec);
 void        empty_record(DEV_RECORD *rec);
index cc555c4d24e1c113909405fe5c16a816dad92325..7dfd412ecdb568ff35e9b87a8f1761da75a40eb8 100644 (file)
@@ -112,7 +112,7 @@ bool read_records(DCR *dcr,
              *  most likely reading the previous record.
              */
             read_block_from_device(dcr, NO_BLOCK_NUMBER_CHECK);
-            read_record_from_block(block, trec);
+            read_record_from_block(dcr, block, trec);
             handle_session_record(dev, trec, &sessrec);
             ok = record_cb(dcr, trec);
             free_record(trec);
@@ -188,7 +188,7 @@ bool read_records(DCR *dcr,
       rec->state = 0;
       Dmsg1(dbglvl, "Block %s empty\n", is_block_empty(rec)?"is":"NOT");
       for (rec->state=0; ok && !is_block_empty(rec); ) {
-         if (!read_record_from_block(block, rec)) {
+         if (!read_record_from_block(dcr, block, rec)) {
             Dmsg3(400, "!read-break. state=%s blk=%d rem=%d\n", rec_state_to_str(rec),
                   block->BlockNumber, rec->remainder);
             break;
index f5827f2afe5e2b0870b4ca2101c28369c11d5ad8..1fd96ca2dd9a3fb3fd4cbd866a884e5903998678 100644 (file)
@@ -426,7 +426,7 @@ bool can_write_record_to_block(DEV_BLOCK *block, DEV_RECORD *rec)
  *                 routine may have to be called again with a new
  *                 block if the entire record was not read.
  */
-bool read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec)
+bool read_record_from_block(DCR *dcr, DEV_BLOCK *block, DEV_RECORD *rec)
 {
    ser_declare;
    uint32_t remlen;
@@ -538,7 +538,18 @@ bool read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec)
       return false;
    }
 
-   ASSERT(data_bytes < MAX_BLOCK_LENGTH);       /* temp sanity check */
+   /* Sanity check */
+   if (data_bytes >= MAX_BLOCK_LENGTH) {
+      /*
+       * Something is wrong, force read of next block, abort 
+       *   continuing with this block.
+       */
+      rec->state |= (REC_NO_HEADER | REC_BLOCK_EMPTY);
+      empty_block(block);
+      Jmsg2(dcr->jcr, M_WARNING, 0, _("Sanity check failed. maxlen=%d datalen=%d. Block discarded.\n"),
+         MAX_BLOCK_LENGTH, data_bytes);
+      return false;
+   }
 
    rec->data = check_pool_memory_size(rec->data, rec->data_len+data_bytes);
 
@@ -565,7 +576,7 @@ bool read_record_from_block(DEV_BLOCK *block, DEV_RECORD *rec)
       rec->remainder = 1;             /* partial record transferred */
       Dmsg1(450, "read_record_block: partial xfered=%d\n", rec->data_len);
       rec->state |= (REC_PARTIAL_RECORD | REC_BLOCK_EMPTY);
-      return 1;
+      return true;
    }
    rec->remainder = 0;
    Dmsg4(450, "Rtn full rd_rec_blk FI=%s SessId=%d Strm=%s len=%d\n",
index 2adab9c47b17d4d3785ad05d747d03aa35bf7538..c98ffb5303dfccd48834dba678d8d909973e92e9 100644 (file)
@@ -1,8 +1,19 @@
               Technical notes on version 1.39  
 
 General:
+13Dec06
+kes  Implement code that should properly set that a job was migrated,    
+     if the migration was successful even if there were no file to
+     migrate.
+kes  Apply Richard's patch to fix building or filed/restore.c without
+     OpenSSL support.
+kes  Ensure that at least one block is written by the SD even if the
+     FD dies or fails -- should fix bug #728.
+kes  Convert stored/record.c ASSERT into a soft fail if the length of   
+     a record is too insanely long. This should fix bug #???
 12Dec06
-
+kes  Fix automatic labeling of File volumes, which was broken by new
+     removable device code.
 10Dec06
 kes  Remove typedef uLong for HP in baconfig.h.  It broke things.
 lf   Fix job byte reporting -- the digest code runs in verify.c and