]> git.sur5r.net Git - bacula/bacula/commitdiff
- Fix how FileSet is saved in job record to correct continual
authorKern Sibbald <kern@sibbald.com>
Mon, 15 Aug 2005 08:48:01 +0000 (08:48 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 15 Aug 2005 08:48:01 +0000 (08:48 +0000)
  Full save.

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

bacula/kes-1.37
bacula/src/cats/protos.h
bacula/src/cats/sql_find.c
bacula/src/dird/backup.c
bacula/src/dird/fd_cmds.c
bacula/src/dird/job.c
bacula/src/dird/mac.c
bacula/src/dird/protos.h
bacula/src/dird/ua_cmds.c

index 5691cf76d70fca172f83f5b9c8d67843f467eb11..995ac9f0b54cad58d9fbb49c85329174be96f38f 100644 (file)
@@ -5,6 +5,8 @@ General:
 
 Changes to 1.37.36:
 15Aug05
+- Fix how FileSet is saved in job record to correct continual  
+  Full save.
 - Make datadir print on config.out listing.
 - Move get FileSet record up in backup init to eliminate continual
   Full save seen by Peter Sjoberg.
index bc301d22efca25bd1b5d68f7cd4d17cbc4453f2e..ede3b2b7112614d349f662fdfa47a83cfbe53bc8 100644 (file)
@@ -64,7 +64,7 @@ int db_delete_pool_record(JCR *jcr, B_DB *db, POOL_DBR *pool_dbr);
 int db_delete_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr);
 
 /* find.c */
-int db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime);
+bool db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime);
 int db_find_last_jobid(JCR *jcr, B_DB *mdb, const char *Name, JOB_DBR *jr);
 int db_find_next_volume(JCR *jcr, B_DB *mdb, int index, bool InChanger, MEDIA_DBR *mr);
 bool db_find_failed_job_since(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *stime, int &JobLevel);
index 354038280f59f58276e1a35b6207e75ad3dbd647..33ae9b0ac30aa7629cf7721723479c246afe5177 100644 (file)
@@ -2,39 +2,34 @@
  * Bacula Catalog Database Find record interface routines
  *
  *  Note, generally, these routines are more complicated
- *       that a simple search by name or id. Such simple
- *       request are in get.c
+ *        that a simple search by name or id. Such simple
+ *        request are in get.c
  *
  *    Kern Sibbald, December 2000
  *
  *    Version $Id$
  */
-
 /*
    Copyright (C) 2000-2005 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of
-   the License, or (at your option) any later version.
+   modify it under the terms of the GNU General Public License
+   version 2 as amended with additional clauses defined in the
+   file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with this program; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
+   the file LICENSE for additional details.
 
  */
 
 
+
 /* The following is necessary so that we do not include
  * the dummy external definition of DB.
  */
-#define __SQL_C                      /* indicate that this is sql.c */
+#define __SQL_C                       /* indicate that this is sql.c */
 
 #include "bacula.h"
 #include "cats.h"
@@ -59,9 +54,9 @@ extern int QueryDB(const char *file, int line, JCR *jcr, B_DB *db, char *select_
  *  StartTime is returned in stime
  *
  * Returns: 0 on failure
- *         1 on success, jr is unchanged, but stime is set
+ *          1 on success, jr is unchanged, but stime is set
  */
-int
+bool
 db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime)
 {
    SQL_ROW row;
@@ -73,69 +68,64 @@ db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime)
    /* If no Id given, we must find corresponding job */
    if (jr->JobId == 0) {
       /* Differential is since last Full backup */
-        Mmsg(mdb->cmd,
+         Mmsg(mdb->cmd,
 "SELECT StartTime FROM Job WHERE JobStatus='T' AND Type='%c' AND "
 "Level='%c' AND Name='%s' AND ClientId=%s AND FileSetId=%s "
 "ORDER BY StartTime DESC LIMIT 1",
-          jr->JobType, L_FULL, jr->Name, 
-          edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2));
+           jr->JobType, L_FULL, jr->Name, 
+           edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2));
 
       if (jr->JobLevel == L_DIFFERENTIAL) {
-        /* SQL cmd for Differential backup already edited above */
+         /* SQL cmd for Differential backup already edited above */
 
       /* Incremental is since last Full, Incremental, or Differential */
       } else if (jr->JobLevel == L_INCREMENTAL) {
-        /*
-         * For an Incremental job, we must first ensure
-         *  that a Full backup was done (cmd edited above)
-         *  then we do a second look to find the most recent
-         *  backup
-         */
-        if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
+         /*
+          * For an Incremental job, we must first ensure
+          *  that a Full backup was done (cmd edited above)
+          *  then we do a second look to find the most recent
+          *  backup
+          */
+         if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
             Mmsg2(&mdb->errmsg, _("Query error for start time request: ERR=%s\nCMD=%s\n"),
-              sql_strerror(mdb), mdb->cmd);
-           db_unlock(mdb);
-           return 0;
-        }
-        if ((row = sql_fetch_row(mdb)) == NULL) {
-           sql_free_result(mdb);
+               sql_strerror(mdb), mdb->cmd);
+            goto bail_out;
+         }
+         if ((row = sql_fetch_row(mdb)) == NULL) {
+            sql_free_result(mdb);
             Mmsg(mdb->errmsg, _("No prior Full backup Job record found.\n"));
-           db_unlock(mdb);
-           return 0;
-        }
-        sql_free_result(mdb);
-        /* Now edit SQL command for Incremental Job */
-        Mmsg(mdb->cmd,
+            goto bail_out;
+         }
+         sql_free_result(mdb);
+         /* Now edit SQL command for Incremental Job */
+         Mmsg(mdb->cmd,
 "SELECT StartTime FROM Job WHERE JobStatus='T' AND Type='%c' AND "
 "Level IN ('%c','%c','%c') AND Name='%s' AND ClientId=%s "
 "AND FileSetId=%s ORDER BY StartTime DESC LIMIT 1",
-           jr->JobType, L_INCREMENTAL, L_DIFFERENTIAL, L_FULL, jr->Name,
-           edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2));
+            jr->JobType, L_INCREMENTAL, L_DIFFERENTIAL, L_FULL, jr->Name,
+            edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2));
       } else {
          Mmsg1(&mdb->errmsg, _("Unknown level=%d\n"), jr->JobLevel);
-        db_unlock(mdb);
-        return 0;
+         goto bail_out;
       }
    } else {
       Dmsg1(100, "Submitting: %s\n", mdb->cmd);
       Mmsg(mdb->cmd, "SELECT StartTime FROM Job WHERE Job.JobId=%s", 
-          edit_int64(jr->JobId, ed1));
+           edit_int64(jr->JobId, ed1));
    }
 
    if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
       pm_strcpy(stime, "");                   /* set EOS */
       Mmsg2(&mdb->errmsg, _("Query error for start time request: ERR=%s\nCMD=%s\n"),
-        sql_strerror(mdb),  mdb->cmd);
-      db_unlock(mdb);
-      return 0;
+         sql_strerror(mdb),  mdb->cmd);
+      goto bail_out;
    }
 
    if ((row = sql_fetch_row(mdb)) == NULL) {
       Mmsg2(&mdb->errmsg, _("No Job record found: ERR=%s\nCMD=%s\n"),
-        sql_strerror(mdb),  mdb->cmd);
+         sql_strerror(mdb),  mdb->cmd);
       sql_free_result(mdb);
-      db_unlock(mdb);
-      return 0;
+      goto bail_out;
    }
    Dmsg1(100, "Got start time: %s\n", row[0]);
    pm_strcpy(stime, row[0]);
@@ -143,7 +133,11 @@ db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime)
    sql_free_result(mdb);
 
    db_unlock(mdb);
-   return 1;
+   return true;
+
+bail_out:
+   db_unlock(mdb);
+   return false;
 }
 
 /*
@@ -151,8 +145,8 @@ db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime)
  *   it must be either Full or Diff.
  *
  * Returns: false on failure
- *         true  on success, jr is unchanged and stime unchanged
- *               level returned in JobLevel
+ *          true  on success, jr is unchanged and stime unchanged
+ *                level returned in JobLevel
  */
 bool
 db_find_failed_job_since(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *stime, int &JobLevel)
@@ -167,9 +161,9 @@ db_find_failed_job_since(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *stime, int &
 "Level IN ('%c','%c') AND Name='%s' AND ClientId=%s "
 "AND FileSetId=%s AND StartTime>'%s' "
 "ORDER BY StartTime DESC LIMIT 1",
-        jr->JobType, L_FULL, L_DIFFERENTIAL, jr->Name,
-        edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2),
-        stime);
+         jr->JobType, L_FULL, L_DIFFERENTIAL, jr->Name,
+         edit_int64(jr->ClientId, ed1), edit_int64(jr->FileSetId, ed2),
+         stime);
 
    if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
       db_unlock(mdb);
@@ -195,7 +189,7 @@ db_find_failed_job_since(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM *stime, int &
  *   For VERIFY_VOLUME_TO_CATALOG, we want the JobId of the last Job.
  *
  * Returns: 1 on success
- *         0 on failure
+ *          0 on failure
  */
 int
 db_find_last_jobid(JCR *jcr, B_DB *mdb, const char *Name, JOB_DBR *jr)
@@ -210,19 +204,19 @@ db_find_last_jobid(JCR *jcr, B_DB *mdb, const char *Name, JOB_DBR *jr)
 "SELECT JobId FROM Job WHERE Type='V' AND Level='%c' AND "
 " JobStatus='T' AND Name='%s' AND "
 "ClientId=%s ORDER BY StartTime DESC LIMIT 1",
-          L_VERIFY_INIT, jr->Name, 
-          edit_int64(jr->ClientId, ed1));
+           L_VERIFY_INIT, jr->Name, 
+           edit_int64(jr->ClientId, ed1));
    } else if (jr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG ||
-             jr->JobLevel == L_VERIFY_DISK_TO_CATALOG) {
+              jr->JobLevel == L_VERIFY_DISK_TO_CATALOG) {
       if (Name) {
-        Mmsg(mdb->cmd,
+         Mmsg(mdb->cmd,
 "SELECT JobId FROM Job WHERE Type='B' AND JobStatus='T' AND "
 "Name='%s' ORDER BY StartTime DESC LIMIT 1", Name);
       } else {
-        Mmsg(mdb->cmd,
+         Mmsg(mdb->cmd,
 "SELECT JobId FROM Job WHERE Type='B' AND JobStatus='T' AND "
 "ClientId=%s ORDER BY StartTime DESC LIMIT 1", 
-          edit_int64(jr->ClientId, ed1));
+           edit_int64(jr->ClientId, ed1));
       }
    } else {
       Mmsg1(&mdb->errmsg, _("Unknown Job level=%c\n"), jr->JobLevel);
@@ -261,7 +255,7 @@ db_find_last_jobid(JCR *jcr, B_DB *mdb, const char *Name, JOB_DBR *jr)
  * Find a Volume for a given PoolId, MediaType, and Status.
  *
  * Returns: 0 on failure
- *         numrows on success
+ *          numrows on success
  */
 int
 db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr)
@@ -272,7 +266,7 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr
    char ed1[50];
 
    db_lock(mdb);
-   if (item == -1) {      /* find oldest volume */
+   if (item == -1) {       /* find oldest volume */
       /* Find oldest volume */
       Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,"
           "VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes,"
@@ -282,7 +276,7 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr
           "FROM Media WHERE PoolId=%s AND MediaType='%s' AND VolStatus IN ('Full',"
           "'Recycle','Purged','Used','Append') "
           "ORDER BY LastWritten LIMIT 1", 
-         edit_int64(mr->PoolId, ed1), mr->MediaType);
+          edit_int64(mr->PoolId, ed1), mr->MediaType);
      item = 1;
    } else {
       /* Find next available volume */
@@ -305,8 +299,8 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr
           "FROM Media WHERE PoolId=%s AND MediaType='%s' AND VolStatus='%s' "
           "%s "
           "%s LIMIT %d",
-         edit_int64(mr->PoolId, ed1), mr->MediaType,
-         mr->VolStatus, changer, order, item);
+          edit_int64(mr->PoolId, ed1), mr->MediaType,
+          mr->VolStatus, changer, order, item);
    }
    if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
       db_unlock(mdb);
@@ -316,7 +310,7 @@ db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR *mr
    numrows = sql_num_rows(mdb);
    if (item > numrows) {
       Mmsg2(&mdb->errmsg, _("Request for Volume item %d greater than max %d\n"),
-        item, numrows);
+         item, numrows);
       db_unlock(mdb);
       return 0;
    }
index af58f298a4d2f634ab515af753241be54581e6d7..0d2b181355db2b9ba9ae26adb33a54189f51f241 100644 (file)
@@ -48,14 +48,11 @@ static char EndJob[]     = "2800 End Job TermCode=%d JobFiles=%u "
  */
 bool do_backup_init(JCR *jcr)
 {
-   FILESET_DBR fsr;
    POOL_DBR pr;
 
-   memset(&fsr, 0, sizeof(fsr);
-   if (!get_or_create_fileset_record(jcr, &fsr)) {
+   if (!get_or_create_fileset_record(jcr)) {
       return false;
    }
-   bstrncpy(jcr->FSCreateTime, fsr.cCreateTime, sizeof(jcr->FSCreateTime));
 
    /* 
     * Get definitive Job level and since time
index c0f2cddc79ef6afb5ee1fe886de137f8ee31a4d8..d3c02e1c322c19b4ab7fa1d75b39ffde11582a55 100644 (file)
@@ -140,7 +140,7 @@ void get_level_since_time(JCR *jcr, char *since, int since_len)
 
    since[0] = 0;
    if (jcr->cloned) {
-      if ( jcr->stime && jcr->stime[0]) {
+      if (jcr->stime && jcr->stime[0]) {
          bstrncpy(since, _(", since="), since_len);
          bstrncat(since, jcr->stime, since_len);
       }
index faef49445ae0c4371c159e54b0b61582fe8fd43e..ecb0d7bf345ecab6789e7047255868e14e13880b 100644 (file)
@@ -634,32 +634,34 @@ bool get_or_create_client_record(JCR *jcr)
    return true;
 }
 
-bool get_or_create_fileset_record(JCR *jcr, FILESET_DBR *fsr)
+bool get_or_create_fileset_record(JCR *jcr)
 {
+   FILESET_DBR fsr;
    /*
     * Get or Create FileSet record
     */
-   memset(fsr, 0, sizeof(FILESET_DBR));
-   bstrncpy(fsr->FileSet, jcr->fileset->hdr.name, sizeof(fsr->FileSet));
+   memset(&fsr, 0, sizeof(FILESET_DBR));
+   bstrncpy(fsr.FileSet, jcr->fileset->hdr.name, sizeof(fsr.FileSet));
    if (jcr->fileset->have_MD5) {
       struct MD5Context md5c;
       unsigned char signature[16];
       memcpy(&md5c, &jcr->fileset->md5c, sizeof(md5c));
       MD5Final(signature, &md5c);
-      bin_to_base64(fsr->MD5, (char *)signature, 16); /* encode 16 bytes */
-      bstrncpy(jcr->fileset->MD5, fsr->MD5, sizeof(jcr->fileset->MD5));
+      bin_to_base64(fsr.MD5, (char *)signature, 16); /* encode 16 bytes */
+      bstrncpy(jcr->fileset->MD5, fsr.MD5, sizeof(jcr->fileset->MD5));
    } else {
       Jmsg(jcr, M_WARNING, 0, _("FileSet MD5 signature not found.\n"));
    }
    if (!jcr->fileset->ignore_fs_changes ||
-       !db_get_fileset_record(jcr, jcr->db, fsr)) {
-      if (!db_create_fileset_record(jcr, jcr->db, fsr)) {
+       !db_get_fileset_record(jcr, jcr->db, &fsr)) {
+      if (!db_create_fileset_record(jcr, jcr->db, &fsr)) {
          Jmsg(jcr, M_ERROR, 0, _("Could not create FileSet \"%s\" record. ERR=%s\n"),
-            fsr->FileSet, db_strerror(jcr->db));
+            fsr.FileSet, db_strerror(jcr->db));
          return false;
       }
    }
-   jcr->jr.FileSetId = fsr->FileSetId;
+   jcr->jr.FileSetId = fsr.FileSetId;
+   bstrncpy(jcr->FSCreateTime, fsr.cCreateTime, sizeof(jcr->FSCreateTime));
    Dmsg2(119, "Created FileSet %s record %u\n", jcr->fileset->hdr.name,
       jcr->jr.FileSetId);
    return true;
index 3356fb8a1e033233d1de57f0e0662547daecea68..bd6c1d2dc56f903e773311d1f06f8a4e26aadf05 100644 (file)
@@ -9,29 +9,23 @@
  *     Open DB and create records for this job.
  *     Open Message Channel with Storage daemon to tell him a job will be starting.
  *     Open connection with File daemon and pass him commands
- *      to do the backup.
+ *       to do the backup.
  *     When the File daemon finishes the job, update the DB.
  *
  *   Version $Id$
  */
-
 /*
    Copyright (C) 2004-2005 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of
-   the License, or (at your option) any later version.
+   modify it under the terms of the GNU General Public License
+   version 2 as amended with additional clauses defined in the
+   file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with this program; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
+   the file LICENSE for additional details.
 
  */
 
  */
 bool do_mac_init(JCR *jcr)
 {
-   FILESET_DBR fsr;
    POOL_DBR pr;
    JOB_DBR jr;
    JobId_t input_jobid;
    char *Name;
 
-   if (!get_or_create_fileset_record(jcr, &fsr)) {
+   if (!get_or_create_fileset_record(jcr)) {
       return false;
    }
-   bstrncpy(jcr->FSCreateTime, fsr.cCreateTime, sizeof(jcr->FSCreateTime));
 
    /*
     * Find JobId of last job that ran.
@@ -77,17 +69,17 @@ bool do_mac_init(JCR *jcr)
    switch (jcr->JobLevel) {
    case L_FULL:
       if (jcr->full_pool) {
-        jcr->pool = jcr->full_pool;
+         jcr->pool = jcr->full_pool;
       }
       break;
    case L_INCREMENTAL:
       if (jcr->inc_pool) {
-        jcr->pool = jcr->inc_pool;
+         jcr->pool = jcr->inc_pool;
       }
       break;
    case L_DIFFERENTIAL:
       if (jcr->dif_pool) {
-        jcr->pool = jcr->dif_pool;
+         jcr->pool = jcr->dif_pool;
       }
       break;
    }
@@ -98,13 +90,13 @@ bool do_mac_init(JCR *jcr)
       /* Try to create the pool */
       if (create_pool(jcr, jcr->db, jcr->pool, POOL_OP_CREATE) < 0) {
          Jmsg(jcr, M_FATAL, 0, _("Pool %s not in database. %s"), pr.Name,
-           db_strerror(jcr->db));
-        return false;
+            db_strerror(jcr->db));
+         return false;
       } else {
          Jmsg(jcr, M_INFO, 0, _("Pool %s created in database.\n"), pr.Name);
       }
    }
-   jcr->PoolId = pr.PoolId;              /****FIXME**** this can go away */
+   jcr->PoolId = pr.PoolId;               /****FIXME**** this can go away */
    jcr->jr.PoolId = pr.PoolId;
    jcr->needs_sd = true;
    return true;
@@ -114,7 +106,7 @@ bool do_mac_init(JCR *jcr)
  * Do a Migration, Archive, or Copy of a previous job
  *
  *  Returns:  false on failure
- *           true  on success
+ *            true  on success
  */
 bool do_mac(JCR *jcr)
 {
@@ -139,7 +131,7 @@ bool do_mac(JCR *jcr)
 
    /* Print Job Start message */
    Jmsg(jcr, M_INFO, 0, _("Start %s JobId %u, Job=%s\n"),
-       Type, jcr->JobId, jcr->Job);
+        Type, jcr->JobId, jcr->Job);
 
    set_jcr_job_status(jcr, JS_Running);
    Dmsg2(100, "JobId=%d JobLevel=%c\n", jcr->jr.JobId, jcr->jr.JobLevel);
@@ -226,22 +218,22 @@ void mac_cleanup(JCR *jcr, int TermCode)
    }
 
    Dmsg2(100, "Enter mac_cleanup %d %c\n", TermCode, TermCode);
-   dequeue_messages(jcr);            /* display any queued messages */
+   dequeue_messages(jcr);             /* display any queued messages */
    memset(&mr, 0, sizeof(mr));
    set_jcr_job_status(jcr, TermCode);
 
-   update_job_end_record(jcr);       /* update database */
+   update_job_end_record(jcr);        /* update database */
 
    if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) {
       Jmsg(jcr, M_WARNING, 0, _("Error getting job record for stats: %s"),
-        db_strerror(jcr->db));
+         db_strerror(jcr->db));
       set_jcr_job_status(jcr, JS_ErrorTerminated);
    }
 
    bstrncpy(mr.VolumeName, jcr->VolumeName, sizeof(mr.VolumeName));
    if (!db_get_media_record(jcr, jcr->db, &mr)) {
       Jmsg(jcr, M_WARNING, 0, _("Error getting Media record for Volume \"%s\": ERR=%s"),
-        mr.VolumeName, db_strerror(jcr->db));
+         mr.VolumeName, db_strerror(jcr->db));
       set_jcr_job_status(jcr, JS_ErrorTerminated);
    }
 
@@ -256,87 +248,87 @@ void mac_cleanup(JCR *jcr, int TermCode)
       int VolCount;
 
       if (*fname == '|') {
-        fname++;
-        got_pipe = 1;
+         fname++;
+         got_pipe = 1;
          bpipe = open_bpipe(fname, 0, "w");
-        fd = bpipe ? bpipe->wfd : NULL;
+         fd = bpipe ? bpipe->wfd : NULL;
       } else {
-        /* ***FIXME*** handle BASE */
+         /* ***FIXME*** handle BASE */
          fd = fopen(fname, jcr->JobLevel==L_FULL?"w+":"a+");
       }
       if (fd) {
-        VolCount = db_get_job_volume_parameters(jcr, jcr->db, jcr->JobId,
-                   &VolParams);
-        if (VolCount == 0) {
+         VolCount = db_get_job_volume_parameters(jcr, jcr->db, jcr->JobId,
+                    &VolParams);
+         if (VolCount == 0) {
             Jmsg(jcr, M_ERROR, 0, _("Could not get Job Volume Parameters to "
                  "update Bootstrap file. ERR=%s\n"), db_strerror(jcr->db));
-            if (jcr->SDJobFiles != 0) {
-               set_jcr_job_status(jcr, JS_ErrorTerminated);
-            }
+             if (jcr->SDJobFiles != 0) {
+                set_jcr_job_status(jcr, JS_ErrorTerminated);
+             }
 
-        }
-        for (int i=0; i < VolCount; i++) {
-           /* Write the record */
+         }
+         for (int i=0; i < VolCount; i++) {
+            /* Write the record */
             fprintf(fd, "Volume=\"%s\"\n", VolParams[i].VolumeName);
             fprintf(fd, "MediaType=\"%s\"\n", VolParams[i].MediaType);
             fprintf(fd, "VolSessionId=%u\n", jcr->VolSessionId);
             fprintf(fd, "VolSessionTime=%u\n", jcr->VolSessionTime);
             fprintf(fd, "VolFile=%u-%u\n", VolParams[i].StartFile,
-                        VolParams[i].EndFile);
+                         VolParams[i].EndFile);
             fprintf(fd, "VolBlock=%u-%u\n", VolParams[i].StartBlock,
-                        VolParams[i].EndBlock);
+                         VolParams[i].EndBlock);
             fprintf(fd, "FileIndex=%d-%d\n", VolParams[i].FirstIndex,
-                        VolParams[i].LastIndex);
-        }
-        if (VolParams) {
-           free(VolParams);
-        }
-        if (got_pipe) {
-           close_bpipe(bpipe);
-        } else {
-           fclose(fd);
-        }
+                         VolParams[i].LastIndex);
+         }
+         if (VolParams) {
+            free(VolParams);
+         }
+         if (got_pipe) {
+            close_bpipe(bpipe);
+         } else {
+            fclose(fd);
+         }
       } else {
-        berrno be;
+         berrno be;
          Jmsg(jcr, M_ERROR, 0, _("Could not open WriteBootstrap file:\n"
               "%s: ERR=%s\n"), fname, be.strerror());
-        set_jcr_job_status(jcr, JS_ErrorTerminated);
+         set_jcr_job_status(jcr, JS_ErrorTerminated);
       }
    }
 
-   msg_type = M_INFO;                /* by default INFO message */
+   msg_type = M_INFO;                 /* by default INFO message */
    switch (jcr->JobStatus) {
       case JS_Terminated:
-        if (jcr->Errors || jcr->SDErrors) {
+         if (jcr->Errors || jcr->SDErrors) {
             term_msg = _("Backup OK -- with warnings");
-        } else {
+         } else {
             term_msg = _("Backup OK");
-        }
-        break;
+         }
+         break;
       case JS_FatalError:
       case JS_ErrorTerminated:
          term_msg = _("*** Backup Error ***");
-        msg_type = M_ERROR;          /* Generate error message */
-        if (jcr->store_bsock) {
-           bnet_sig(jcr->store_bsock, BNET_TERMINATE);
-           if (jcr->SD_msg_chan) {
-              pthread_cancel(jcr->SD_msg_chan);
-           }
-        }
-        break;
+         msg_type = M_ERROR;          /* Generate error message */
+         if (jcr->store_bsock) {
+            bnet_sig(jcr->store_bsock, BNET_TERMINATE);
+            if (jcr->SD_msg_chan) {
+               pthread_cancel(jcr->SD_msg_chan);
+            }
+         }
+         break;
       case JS_Canceled:
          term_msg = _("Backup Canceled");
-        if (jcr->store_bsock) {
-           bnet_sig(jcr->store_bsock, BNET_TERMINATE);
-           if (jcr->SD_msg_chan) {
-              pthread_cancel(jcr->SD_msg_chan);
-           }
-        }
-        break;
+         if (jcr->store_bsock) {
+            bnet_sig(jcr->store_bsock, BNET_TERMINATE);
+            if (jcr->SD_msg_chan) {
+               pthread_cancel(jcr->SD_msg_chan);
+            }
+         }
+         break;
       default:
-        term_msg = term_code;
+         term_msg = term_code;
          sprintf(term_code, _("Inappropriate term code: %c\n"), jcr->JobStatus);
-        break;
+         break;
    }
    bstrftimes(sdt, sizeof(sdt), jcr->jr.StartTime);
    bstrftimes(edt, sizeof(edt), jcr->jr.EndTime);
@@ -356,7 +348,7 @@ void mac_cleanup(JCR *jcr, int TermCode)
       if (jcr->JobStatus == JS_Terminated && jcr->jr.JobBytes) {
          Jmsg(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db));
       }
-      jcr->VolumeName[0] = 0;        /* none */
+      jcr->VolumeName[0] = 0;         /* none */
    }
 
    if (jcr->ReadBytes == 0) {
@@ -372,7 +364,7 @@ void mac_cleanup(JCR *jcr, int TermCode)
    jobstatus_to_ascii(jcr->FDJobStatus, fd_term_msg, sizeof(fd_term_msg));
    jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg));
 
-// bmicrosleep(15, 0);               /* for debugging SIGHUP */
+// bmicrosleep(15, 0);                /* for debugging SIGHUP */
 
    Jmsg(jcr, msg_type, 0, _("Bacula %s (%s): %s\n"
 "  JobId:                  %d\n"
@@ -400,30 +392,30 @@ void mac_cleanup(JCR *jcr, int TermCode)
 "  Termination:            %s\n\n"),
    VERSION,
    LSMDATE,
-       edt,
-       jcr->jr.JobId,
-       jcr->jr.Job,
-       level_to_str(jcr->JobLevel), jcr->since,
-       jcr->client->hdr.name,
-       jcr->fileset->hdr.name, jcr->FSCreateTime,
-       jcr->pool->hdr.name,
-       sdt,
-       edt,
-       edit_uint64_with_commas(jcr->jr.JobFiles, ec1),
-       edit_uint64_with_commas(jcr->SDJobFiles, ec4),
-       edit_uint64_with_commas(jcr->jr.JobBytes, ec2),
-       edit_uint64_with_commas(jcr->SDJobBytes, ec5),
-       (float)kbps,
-       compress,
-       jcr->VolumeName,
-       jcr->VolSessionId,
-       jcr->VolSessionTime,
-       edit_uint64_with_commas(mr.VolBytes, ec3),
-       jcr->Errors,
-       jcr->SDErrors,
-       fd_term_msg,
-       sd_term_msg,
-       term_msg);
+        edt,
+        jcr->jr.JobId,
+        jcr->jr.Job,
+        level_to_str(jcr->JobLevel), jcr->since,
+        jcr->client->hdr.name,
+        jcr->fileset->hdr.name, jcr->FSCreateTime,
+        jcr->pool->hdr.name,
+        sdt,
+        edt,
+        edit_uint64_with_commas(jcr->jr.JobFiles, ec1),
+        edit_uint64_with_commas(jcr->SDJobFiles, ec4),
+        edit_uint64_with_commas(jcr->jr.JobBytes, ec2),
+        edit_uint64_with_commas(jcr->SDJobBytes, ec5),
+        (float)kbps,
+        compress,
+        jcr->VolumeName,
+        jcr->VolSessionId,
+        jcr->VolSessionTime,
+        edit_uint64_with_commas(mr.VolBytes, ec3),
+        jcr->Errors,
+        jcr->SDErrors,
+        fd_term_msg,
+        sd_term_msg,
+        term_msg);
 
    Dmsg0(100, "Leave mac_cleanup()\n");
 }
index b96d60ba53b9c74aa1126e6080e9e15a51d0e63e..a7da723d9104d4997b77519909ef3336bf180236 100644 (file)
@@ -92,7 +92,7 @@ extern void set_jcr_defaults(JCR *jcr, JOB *job);
 extern void create_unique_job_name(JCR *jcr, const char *base_name);
 extern void update_job_end_record(JCR *jcr);
 extern bool get_or_create_client_record(JCR *jcr);
-extern bool get_or_create_fileset_record(JCR *jcr, FILESET_DBR *fsr);
+extern bool get_or_create_fileset_record(JCR *jcr);
 extern JobId_t run_job(JCR *jcr);
 extern bool cancel_job(UAContext *ua, JCR *jcr);
 extern void init_jcr_job_record(JCR *jcr);
index 692a7b69ed2b639c787d990c3c494a213b93e571..47508a6e92cf23f63d3911ca5a5487fea1b330e6 100644 (file)
@@ -902,7 +902,6 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
    JOB *job = NULL;
    CLIENT *client = NULL;
    FILESET *fileset = NULL;
-   FILESET_DBR fsr;
    int listing = 0;
    char since[MAXSTRING];
    JCR *jcr = ua->jcr;
@@ -973,7 +972,7 @@ static int estimate_cmd(UAContext *ua, const char *cmd)
    if (!get_or_create_client_record(jcr)) {
       return 1;
    }
-   if (!get_or_create_fileset_record(jcr, &fsr)) {
+   if (!get_or_create_fileset_record(jcr)) {
       return 1;
    }