]> git.sur5r.net Git - bacula/bacula/commitdiff
- Set reconnect flag in MySQL packet to 1 to ensure that connection
authorKern Sibbald <kern@sibbald.com>
Sun, 15 May 2005 19:35:00 +0000 (19:35 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 15 May 2005 19:35:00 +0000 (19:35 +0000)
  is re-established.  MySQL 5 changed default to 0. Fixes bug report.
- Fix Scratch pool handling as reported in a bug by Eric Bollengier
  by applying his patch.
- Remove delete job in favor of delete jobid.
- Add = NULL to configfile definitions as reported by Eric in a bug
  report.
- Update winbacula.nsi.in to reflect new manual file structure.

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

12 files changed:
bacula/kes-1.37
bacula/src/cats/mysql.c
bacula/src/dird/next_vol.c
bacula/src/dird/ua_cmds.c
bacula/src/stored/bcopy.c
bacula/src/stored/bextract.c
bacula/src/stored/bls.c
bacula/src/stored/bscan.c
bacula/src/stored/btape.c
bacula/src/stored/stored.c
bacula/src/version.h
bacula/src/win32/winbacula.nsi.in

index 8272bfc7794a7fd7b834375d4e20019556f6c6ce..35fa05366ed7fa34816a3857f256ddeb0a799d3f 100644 (file)
@@ -4,6 +4,15 @@
 General:
 
 Changes to 1.37.18:
+15May05
+- Set reconnect flag in MySQL packet to 1 to ensure that connection
+  is re-established.  MySQL 5 changed default to 0. Fixes bug report.
+- Fix Scratch pool handling as reported in a bug by Eric Bollengier
+  by applying his patch.
+- Remove delete job in favor of delete jobid.
+- Add = NULL to configfile definitions as reported by Eric in a bug
+  report.
+- Update winbacula.nsi.in to reflect new manual file structure.
 10May05
 - Correct a minor build problem with wx-console.
 - Add cancel() to Dir Python scripting.
index cf5972fbc74e45cd6671132bd57410fc02b9bce7..9b3f375db2e554e0f0764bb18e0af0c9a2c341ab 100644 (file)
@@ -138,6 +138,7 @@ db_open_database(JCR *jcr, B_DB *mdb)
    mysql_server_init(0, NULL, NULL);
 #endif
    mysql_init(&(mdb->mysql));
+   mdb->mysql.reconnect = 1;             /* so connection does not timeout */
    Dmsg0(50, "mysql_init done\n");
    /* If connection fails, try at 5 sec intervals for 30 seconds. */
    for (int retry=0; retry < 6; retry++) {
index 7db844bbeaf553243cabca89e2ab2276f50c6024..2ced309bd7938703a69840ab4d646cf7eadbf2ba 100644 (file)
@@ -51,7 +51,7 @@ int find_next_volume_for_append(JCR *jcr, MEDIA_DBR *mr, bool create)
    Dmsg2(100, "CatReq FindMedia: Id=%d, MediaType=%s\n", (int)mr->PoolId, mr->MediaType);
    /*
     * If we are using an Autochanger, restrict Volume
-    *  search to the Autochanger on the first pass
+    *   search to the Autochanger on the first pass
     */
    InChanger = store->autochanger;
    /*
@@ -66,110 +66,113 @@ int find_next_volume_for_append(JCR *jcr, MEDIA_DBR *mr, bool create)
       ok = db_find_next_volume(jcr, jcr->db, 1, InChanger, mr);
       Dmsg2(100, "catreq after find_next_vol ok=%d FW=%d\n", ok, mr->FirstWritten);
       if (!ok) {
-        /*
-         * 2. Try finding a recycled volume
-         */
-        ok = find_recycled_volume(jcr, InChanger, mr);
+         /*
+          * 2. Try finding a recycled volume
+          */
+         ok = find_recycled_volume(jcr, InChanger, mr);
          Dmsg2(100, "find_recycled_volume %d FW=%d\n", ok, mr->FirstWritten);
-        if (!ok) {
-           /*
-            * 3. Try recycling any purged volume
-            */
-           ok = recycle_oldest_purged_volume(jcr, InChanger, mr);
-           if (!ok) {
-              /*
-               * 4. Try pruning Volumes
-               */
-              prune_volumes(jcr);
-              ok = recycle_oldest_purged_volume(jcr, InChanger, mr);
-              if (InChanger) {
-                 InChanger = false;
-                 if (!ok) {
-                    continue;           /* retry again accepting any volume */
-                 }
-              }
+         if (!ok) {
+            /*
+             * 3. Try recycling any purged volume
+             */
+            ok = recycle_oldest_purged_volume(jcr, InChanger, mr);
+            if (!ok) {
+               /*
+                * 4. Try pruning Volumes
+                */
+               prune_volumes(jcr);
+               ok = recycle_oldest_purged_volume(jcr, InChanger, mr);
+               if (InChanger) {
+                  InChanger = false;
+                  if (!ok) {
+                     continue;           /* retry again accepting any volume */
+                  }
+               }
                Dmsg2(200, "find_recycled_volume2 %d FW=%d\n", ok, mr->FirstWritten);
-              if (!ok && create) {
-                 /*
+               if (!ok && create) {
+                  /*
                    * 5. Try "creating" a new Volume
-                  */
-                 ok = newVolume(jcr, mr);
-              }
-           }
-        }
+                   */
+                  ok = newVolume(jcr, mr);
+               }
+            }
+         }
 
-        if (!ok) {
-           MEDIA_DBR smr;
-           POOL_DBR pr;
-           POOLMEM *query;
-           char ed1[50], ed2[50];
-           /*
-            * 6. Try pulling a volume from the Scratch pool
-            */ 
-            memset(&pr, 0, sizeof(pr));
+         if (!ok) {
+            MEDIA_DBR smr;
+            POOL_DBR pr;
+            POOLMEM *query;
+            char ed1[50], ed2[50];
+            /*
+             * 6. Try pulling a volume from the Scratch pool
+             */ 
+             memset(&pr, 0, sizeof(pr));
              bstrncpy(pr.Name, "Scratch", sizeof(pr.Name));
-            if (db_get_pool_record(jcr, jcr->db, &pr)) {
-               memset(&smr, 0, sizeof(smr));
-               smr.PoolId = pr.PoolId;
+             if (db_get_pool_record(jcr, jcr->db, &pr)) {
+                memset(&smr, 0, sizeof(smr));
+                smr.PoolId = pr.PoolId;
                 bstrncpy(smr.VolStatus, "Append", sizeof(smr.VolStatus));  /* want only appendable volumes */
-               bstrncpy(smr.MediaType, mr->MediaType, sizeof(smr.MediaType));
-               if (db_find_next_volume(jcr, jcr->db, 1, InChanger, &smr)) {
-                  query = get_pool_memory(PM_MESSAGE);
-                  db_lock(jcr->db);
+                bstrncpy(smr.MediaType, mr->MediaType, sizeof(smr.MediaType));
+                if (db_find_next_volume(jcr, jcr->db, 1, InChanger, &smr)) {
+                   query = get_pool_memory(PM_MESSAGE);
+                   db_lock(jcr->db);
                    Mmsg(query, "UPDATE Media SET PoolId=%s WHERE MediaId=%s",
-                       edit_int64(mr->PoolId, ed1),
-                       edit_int64(mr->MediaId, ed2));
-                  ok = db_sql_query(jcr->db, query, NULL, NULL);  
-                  db_unlock(jcr->db);
-               }
-            }
-        }
-        /*
-         *  Look at more drastic ways to find an Appendable Volume
-         */
-        if (!ok && (jcr->pool->purge_oldest_volume ||
-                    jcr->pool->recycle_oldest_volume)) {
+                        edit_int64(mr->PoolId, ed1),
+                        edit_int64(smr.MediaId, ed2));
+                   ok = db_sql_query(jcr->db, query, NULL, NULL);  
+                   db_unlock(jcr->db);
+                   /* Set new Pool Id in smr record, then copy it to mr */
+                   smr.PoolId = mr->PoolId;
+                   memcpy(mr, &smr, sizeof(MEDIA_DBR));
+                }
+             }
+         }
+         /*
+          *  Look at more drastic ways to find an Appendable Volume
+          */
+         if (!ok && (jcr->pool->purge_oldest_volume ||
+                     jcr->pool->recycle_oldest_volume)) {
             Dmsg2(200, "No next volume found. PurgeOldest=%d\n RecyleOldest=%d",
-               jcr->pool->purge_oldest_volume, jcr->pool->recycle_oldest_volume);
-           /* Find oldest volume to recycle */
-           ok = db_find_next_volume(jcr, jcr->db, -1, InChanger, mr);
+                jcr->pool->purge_oldest_volume, jcr->pool->recycle_oldest_volume);
+            /* Find oldest volume to recycle */
+            ok = db_find_next_volume(jcr, jcr->db, -1, InChanger, mr);
             Dmsg1(400, "Find oldest=%d\n", ok);
-           if (ok) {
-              UAContext *ua;
+            if (ok) {
+               UAContext *ua;
                Dmsg0(400, "Try purge.\n");
-              /*
-               * 5.  Try to purging oldest volume only if not UA calling us.
-               */
-              ua = new_ua_context(jcr);
-              if (jcr->pool->purge_oldest_volume && create) {
+               /*
+                * 5.  Try to purging oldest volume only if not UA calling us.
+                */
+               ua = new_ua_context(jcr);
+               if (jcr->pool->purge_oldest_volume && create) {
                   Jmsg(jcr, M_INFO, 0, _("Purging oldest volume \"%s\"\n"), mr->VolumeName);
-                 ok = purge_jobs_from_volume(ua, mr);
-              /*
-               * 5. or try recycling the oldest volume
-               */
-              } else if (jcr->pool->recycle_oldest_volume) {
+                  ok = purge_jobs_from_volume(ua, mr);
+               /*
+                * 5. or try recycling the oldest volume
+                */
+               } else if (jcr->pool->recycle_oldest_volume) {
                   Jmsg(jcr, M_INFO, 0, _("Pruning oldest volume \"%s\"\n"), mr->VolumeName);
-                 ok = prune_volume(ua, mr);
-              }
-              free_ua_context(ua);
-              if (ok) {
-                 ok = recycle_volume(jcr, mr);
+                  ok = prune_volume(ua, mr);
+               }
+               free_ua_context(ua);
+               if (ok) {
+                  ok = recycle_volume(jcr, mr);
                   Dmsg1(400, "Recycle after purge oldest=%d\n", ok);
-              }
-           }
-        }
+               }
+            }
+         }
       }
       Dmsg2(100, "VolJobs=%d FirstWritten=%d\n", mr->VolJobs, mr->FirstWritten);
       if (ok) {
-        /* If we can use the volume, check if it is expired */
-        if (has_volume_expired(jcr, mr)) {
-           if (retry++ < 200) {            /* sanity check */
-              continue;                    /* try again from the top */
-           } else {
-              Jmsg(jcr, M_ERROR, 0, _(
+         /* If we can use the volume, check if it is expired */
+         if (has_volume_expired(jcr, mr)) {
+            if (retry++ < 200) {            /* sanity check */
+               continue;                    /* try again from the top */
+            } else {
+               Jmsg(jcr, M_ERROR, 0, _(
 "We seem to be looping trying to find the next volume. I give up.\n"));
-           }
-        }
+            }
+         }
       }
       break;
    } /* end for loop */
@@ -195,46 +198,46 @@ bool has_volume_expired(JCR *jcr, MEDIA_DBR *mr)
          Jmsg(jcr, M_INFO, 0, _("Max Volume bytes exceeded. "
              "Marking Volume \"%s\" as Full.\n"), mr->VolumeName);
          bstrncpy(mr->VolStatus, "Full", sizeof(mr->VolStatus));
-        expired = true;
+         expired = true;
 
       /* Now see if Volume should only be used once */
       } else if (mr->VolBytes > 0 && jcr->pool->use_volume_once) {
          Jmsg(jcr, M_INFO, 0, _("Volume used once. "
              "Marking Volume \"%s\" as Used.\n"), mr->VolumeName);
          bstrncpy(mr->VolStatus, "Used", sizeof(mr->VolStatus));
-        expired = true;
+         expired = true;
 
       /* Now see if Max Jobs written to volume */
       } else if (mr->MaxVolJobs > 0 && mr->MaxVolJobs <= mr->VolJobs) {
          Jmsg(jcr, M_INFO, 0, _("Max Volume jobs exceeded. "
              "Marking Volume \"%s\" as Used.\n"), mr->VolumeName);
          bstrncpy(mr->VolStatus, "Used", sizeof(mr->VolStatus));
-        expired = true;
+         expired = true;
 
       /* Now see if Max Files written to volume */
       } else if (mr->MaxVolFiles > 0 && mr->MaxVolFiles <= mr->VolFiles) {
          Jmsg(jcr, M_INFO, 0, _("Max Volume files exceeded. "
              "Marking Volume \"%s\" as Used.\n"), mr->VolumeName);
          bstrncpy(mr->VolStatus, "Used", sizeof(mr->VolStatus));
-        expired = true;
+         expired = true;
 
       /* Finally, check Use duration expiration */
       } else if (mr->VolUseDuration > 0) {
-        utime_t now = time(NULL);
-        /* See if Vol Use has expired */
-        if (mr->VolUseDuration <= (now - mr->FirstWritten)) {
+         utime_t now = time(NULL);
+         /* See if Vol Use has expired */
+         if (mr->VolUseDuration <= (now - mr->FirstWritten)) {
             Jmsg(jcr, M_INFO, 0, _("Max configured use duration exceeded. "
                "Marking Volume \"%s\" as Used.\n"), mr->VolumeName);
             bstrncpy(mr->VolStatus, "Used", sizeof(mr->VolStatus));
-           expired = true;
-        }
+            expired = true;
+         }
       }
    }
    if (expired) {
       /* Need to update media */
       if (!db_update_media_record(jcr, jcr->db, mr)) {
          Jmsg(jcr, M_ERROR, 0, _("Catalog error updating volume \"%s\". ERR=%s"),
-             mr->VolumeName, db_strerror(jcr->db));
+              mr->VolumeName, db_strerror(jcr->db));
       }
    }
    return expired;
@@ -244,7 +247,7 @@ bool has_volume_expired(JCR *jcr, MEDIA_DBR *mr)
  * Try hard to recycle the current volume
  *
  *  Returns: on failure - reason = NULL
- *          on success - reason - pointer to reason
+ *           on success - reason - pointer to reason
  */
 void check_if_volume_valid_or_recyclable(JCR *jcr, MEDIA_DBR *mr, const char **reason)
 {
@@ -273,12 +276,12 @@ void check_if_volume_valid_or_recyclable(JCR *jcr, MEDIA_DBR *mr, const char **r
    if (strcmp(mr->VolStatus, "Purged") == 0) {
       if (recycle_volume(jcr, mr)) {
          Jmsg(jcr, M_INFO, 0, "Recycled current volume \"%s\"\n", mr->VolumeName);
-        *reason = NULL;
-        return;
+         *reason = NULL;
+         return;
       } else {
          /* In principle this shouldn't happen */
          *reason = "and recycling of current volume failed";
-        return;
+         return;
       }
    }
 
@@ -292,7 +295,7 @@ void check_if_volume_valid_or_recyclable(JCR *jcr, MEDIA_DBR *mr, const char **r
     * needed for?
     */
    if ((mr->LastWritten + mr->VolRetention) < (utime_t)time(NULL)
-        && mr->Recycle && jcr->pool->recycle_current_volume
+         && mr->Recycle && jcr->pool->recycle_current_volume
          && (strcmp(mr->VolStatus, "Full") == 0 ||
             strcmp(mr->VolStatus, "Used") == 0)) {
       /*
@@ -306,14 +309,14 @@ void check_if_volume_valid_or_recyclable(JCR *jcr, MEDIA_DBR *mr, const char **r
       free_ua_context(ua);
 
       if (ok) {
-        /* If fully purged, recycle current volume */
-        if (recycle_volume(jcr, mr)) {
+         /* If fully purged, recycle current volume */
+         if (recycle_volume(jcr, mr)) {
             Jmsg(jcr, M_INFO, 0, "Recycled current volume \"%s\"\n", mr->VolumeName);
-           *reason = NULL;
-        } else {
+            *reason = NULL;
+         } else {
             *reason = "but should be Append, Purged or Recycle (recycling of the "
                "current volume failed)";
-        }
+         }
       } else {
          *reason = "but should be Append, Purged or Recycle (cannot automatically "
             "recycle current volume, as it still contains unpruned data)";
index 1cfceb494fa15692995cf730458cb52567596264..001caca19a0b4349575f515873051a5145e50583 100644 (file)
@@ -1054,14 +1054,13 @@ static int reload_cmd(UAContext *ua, const char *cmd)
  *
  *  delete pool=<pool-name>
  *  delete volume pool=<pool-name> volume=<name>
- *  delete job jobid=xxx
+ *  delete jobid=xxx
  */
 static int delete_cmd(UAContext *ua, const char *cmd)
 {
    static const char *keywords[] = {
       N_("volume"),
       N_("pool"),
-      N_("job"),
       N_("jobid"),
       NULL};
 
@@ -1077,7 +1076,6 @@ static int delete_cmd(UAContext *ua, const char *cmd)
       delete_pool(ua);
       return 1;
    case 2:
-   case 3:
       int i;
       while ((i=find_arg(ua, _("jobid"))) > 0) {
          delete_job(ua);
index 3ceafca90b70b38499269d2a71351be6332832d9..4fb6ad166262a1b5a1064d00ae6dfbca2468610f 100644 (file)
@@ -50,7 +50,7 @@ static uint32_t jobs = 0;
 static DEV_BLOCK *out_block;
 
 #define CONFIG_FILE "bacula-sd.conf"
-char *configfile;
+char *configfile = NULL;
 STORES *me = NULL;                    /* our Global resource */
 bool forge_on = false;                /* proceed inspite of I/O errors */
 pthread_mutex_t device_release_mutex = PTHREAD_MUTEX_INITIALIZER;
index 99a9438bd7807a993d01d09b0e7618bbf40f496c..8dab7ee710c4c55561cfb7c642087d63ea150421 100644 (file)
@@ -63,7 +63,7 @@ static uint32_t wsize;                /* write size */
 static uint64_t fileAddr = 0;         /* file write address */
 
 #define CONFIG_FILE "bacula-sd.conf"
-char *configfile;
+char *configfile = NULL;
 STORES *me = NULL;                    /* our Global resource */
 bool forge_on = false;
 pthread_mutex_t device_release_mutex = PTHREAD_MUTEX_INITIALIZER;
index 1a9a1448bd17d47ba60b68a57198607c99a06c4a..dbf0e0ff9dfe3a117e865fccafedc79785f22e29 100644 (file)
@@ -57,7 +57,7 @@ static uint32_t num_files = 0;
 static ATTR *attr;
 
 #define CONFIG_FILE "bacula-sd.conf"
-char *configfile;
+char *configfile = NULL;
 STORES *me = NULL;                    /* our Global resource */
 bool forge_on = false;
 pthread_mutex_t device_release_mutex = PTHREAD_MUTEX_INITIALIZER;
index 8cc93f69accc67b9f1fa57b83ef8002b94719e5f..d367b99a3efa41fe4c68484615121f82b7ed501d 100644 (file)
@@ -101,7 +101,7 @@ static int num_media = 0;
 static int num_files = 0;
 
 #define CONFIG_FILE "bacula-sd.conf"
-char *configfile;
+char *configfile = NULL;
 STORES *me = NULL;                    /* our Global resource */
 bool forge_on = false;                /* proceed inspite of I/O errors */
 pthread_mutex_t device_release_mutex = PTHREAD_MUTEX_INITIALIZER;
index 86f58b75b64c1702a7380868bd7ccb6ef003a3d5..4c023b36df17c132ebd7469741c7182a495184c0 100644 (file)
@@ -91,7 +91,7 @@ static void do_unfill();
 
 /* Static variables */
 #define CONFIG_FILE "bacula-sd.conf"
-char *configfile;
+char *configfile = NULL;
 
 #define MAX_CMD_ARGS 30
 static POOLMEM *cmd;
index 5d6d3e0b349a002685724f72715062ed047b318b..50bb025aa1f762de3616665f57474e49c43870e3 100644 (file)
@@ -54,7 +54,7 @@ pthread_cond_t wait_device_release = PTHREAD_COND_INITIALIZER;
 
 static uint32_t VolSessionId = 0;
 uint32_t VolSessionTime;
-char *configfile;
+char *configfile = NULL;
 
 /* Global static variables */
 static int foreground = 0;
index 97d8003e37ead9fce7903598c5388df270597481..9dc7ed546613e04bbd5d3406a2b5bea8d4f07d6c 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #undef  VERSION
 #define VERSION "1.37.18"
-#define BDATE   "10 May 2005"
-#define LSMDATE "10May05"
+#define BDATE   "15 May 2005"
+#define LSMDATE "15May05"
 
 /* Debug flags */
 #undef  DEBUG
index a6e9be065216bbee138fa6388f56eae1149002a2..cc83244df6ecae1dc321094bd13beca6bbadaa09 100755 (executable)
@@ -222,10 +222,10 @@ SectionEnd
 Section "Install Documentation" SecDoc
   SetOutPath "$INSTDIR\doc"
   CreateDirectory "$INSTDIR\doc"
-  File ..\..\doc\latex\bacula\*.html
-  File ..\..\doc\latex\bacula\*.png
-  File ..\..\doc\latex\bacula\*.css
-  File ..\..\doc\latex\bacula.pdf
+  File ..\..\..\docs\manual\bacula\*.html
+  File ..\..\..\docs\manual\bacula\*.png
+  File ..\..\..\docs\manual\bacula\*.css
+  File ..\..\..\docs\manual\bacula.pdf
   ; Create Start Menu entry
   SetShellVarContext all
   CreateShortCut "$SMPROGRAMS\Bacula\Manual.lnk" "$INSTDIR\doc\bacula.pdf"