]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Apply patch from Peter Much <pmc@citylink.dinoex.sub.org> that fixes
authorKern Sibbald <kern@sibbald.com>
Fri, 8 Feb 2008 11:19:28 +0000 (11:19 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 8 Feb 2008 11:19:28 +0000 (11:19 +0000)
     a resource embedded run command to find a since time if no explicit
     since time was supplied on the command line.
kes  Apply state-file.patch sent by Allan Black <Allan.Black@btconnect.com>
     that updates the state file at job termination time in addition to
     when the daemon terminates.

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

bacula/AUTHORS
bacula/src/dird/fd_cmds.c
bacula/src/dird/job.c
bacula/src/filed/job.c
bacula/src/lib/jcr.c
bacula/src/stored/job.c
bacula/src/version.h
bacula/technotes-2.3

index f188694af8d386884cdf7523a2df15926becf57d..79964805d0fefcd28800dbb5870f784326b0ace0 100644 (file)
@@ -15,6 +15,7 @@ Aitor Matilla
 Aleksandar Milivojevic
 Alexander Bergolth
 Alexandre Baron
+Allan Black
 Andreas Piesk
 Andrew Ford
 Arno Lehmann
@@ -72,6 +73,7 @@ Nicolas Boichat
 Olivier Lehmann
 Peter Buschmann
 Peter Eriksson
+Peter Much
 Philippe Chauvat
 Phil Stracchino
 Preben Guldberg
index 6c032fb54f69ce769ddafed710933e417f614b94..ffe312c16d7ddaf070ace2c2f5d624af82cce50c 100644 (file)
@@ -163,13 +163,13 @@ void get_level_since_time(JCR *jcr, char *since, int since_len)
    int JobLevel;
 
    since[0] = 0;
-   if (jcr->cloned) {
-      if (jcr->stime && jcr->stime[0]) {
-         bstrncpy(since, _(", since="), since_len);
-         bstrncat(since, jcr->stime, since_len);
-      }
+   /* If job cloned and a since time already given, use it */
+   if (jcr->cloned && jcr->stime && jcr->stime[0]) {
+      bstrncpy(since, _(", since="), since_len);
+      bstrncat(since, jcr->stime, since_len);
       return;
    }
+   /* Make sure stime buffer is allocated */
    if (!jcr->stime) {
       jcr->stime = get_pool_memory(PM_MESSAGE);
    } 
index a66ef0cdae4be701c47f81d61357781be22b53f7..15beadf27350f440a49f48ba392fcd425b6e4813 100644 (file)
@@ -892,6 +892,10 @@ void dird_free_jcr(JCR *jcr)
    free_rwstorage(jcr);
 
    jcr->job_end_push.destroy();
+
+   if (jcr->JobId != 0)
+      write_state_file(director->working_directory, "bacula-dir", get_first_port_host_order(director->DIRaddrs));
+
    Dmsg0(200, "End dird free_jcr\n");
 }
 
index 5673a633cc1f2b3b8983b4b9c4a7cbb0a32d18b6..7ee5cb826de1430d9e24718fe701f4eb1fbe69fe 100644 (file)
@@ -1797,6 +1797,9 @@ static void filed_free_jcr(JCR *jcr)
    free_runscripts(jcr->RunScripts);
    delete jcr->RunScripts;
 
+   if (jcr->JobId != 0)
+      write_state_file(me->working_directory, "bacula-fd", get_first_port_host_order(me->FDaddrs));
+
    return;
 }
 
index ae4e40e9ecf1d88d2df5fdd68a5cccab19c149ce..b193fcbfcc5f70d29c6ce3c8c822d9701eb12a73 100644 (file)
@@ -336,47 +336,6 @@ static void remove_jcr(JCR *jcr)
  */
 static void free_common_jcr(JCR *jcr)
 {
-   struct s_last_job *je, last_job;
-
-   /* Keep some statistics */
-   switch (jcr->JobType) {
-   case JT_BACKUP:
-   case JT_VERIFY:
-   case JT_RESTORE:
-   case JT_MIGRATE:
-   case JT_COPY:
-   case JT_ADMIN:
-      num_jobs_run++;
-      last_job.Errors = jcr->Errors;
-      last_job.JobType = jcr->JobType;
-      last_job.JobId = jcr->JobId;
-      last_job.VolSessionId = jcr->VolSessionId;
-      last_job.VolSessionTime = jcr->VolSessionTime;
-      bstrncpy(last_job.Job, jcr->Job, sizeof(last_job.Job));
-      last_job.JobFiles = jcr->JobFiles;
-      last_job.JobBytes = jcr->JobBytes;
-      last_job.JobStatus = jcr->JobStatus;
-      last_job.JobLevel = jcr->JobLevel;
-      last_job.start_time = jcr->start_time;
-      last_job.end_time = time(NULL);
-      /* Keep list of last jobs, but not Console where JobId==0 */
-      if (last_job.JobId > 0) {
-         je = (struct s_last_job *)malloc(sizeof(struct s_last_job));
-         memcpy((char *)je, (char *)&last_job, sizeof(last_job));
-         if (!last_jobs) {
-            init_last_jobs_list();
-         }
-         last_jobs->append(je);
-         if (last_jobs->size() > max_last_jobs) {
-            je = (struct s_last_job *)last_jobs->first();
-            last_jobs->remove(je);
-            free(je);
-         }
-      }
-      break;
-   default:
-      break;
-   }
    jcr->destroy_mutex();
 
    if (jcr->msg_queue) {
@@ -446,12 +405,15 @@ static void free_common_jcr(JCR *jcr)
 #ifdef DEBUG
 void b_free_jcr(const char *file, int line, JCR *jcr)
 {
+   struct s_last_job *je, last_job;
+
    Dmsg3(dbglvl, "Enter free_jcr jid=%u from %s:%d\n", jcr->JobId, file, line);
 
 #else
 
 void free_jcr(JCR *jcr)
 {
+   struct s_last_job *je, last_job;
 
    Dmsg3(dbglvl, "Enter free_jcr jid=%u use_count=%d Job=%s\n", 
          jcr->JobId, jcr->use_count(), jcr->Job);
@@ -478,14 +440,56 @@ void free_jcr(JCR *jcr)
             jcr->JobId, jcr->use_count(), jcr->Job);
    }
    remove_jcr(jcr);                   /* remove Jcr from chain */
-   unlock_jcr_chain();
 
    job_end_pop(jcr);                  /* pop and call hooked routines */
 
    Dmsg1(dbglvl, "End job=%d\n", jcr->JobId);
+
+   /* Keep some statistics */
+   switch (jcr->JobType) {
+   case JT_BACKUP:
+   case JT_VERIFY:
+   case JT_RESTORE:
+   case JT_MIGRATE:
+   case JT_COPY:
+   case JT_ADMIN:
+      num_jobs_run++;
+      last_job.Errors = jcr->Errors;
+      last_job.JobType = jcr->JobType;
+      last_job.JobId = jcr->JobId;
+      last_job.VolSessionId = jcr->VolSessionId;
+      last_job.VolSessionTime = jcr->VolSessionTime;
+      bstrncpy(last_job.Job, jcr->Job, sizeof(last_job.Job));
+      last_job.JobFiles = jcr->JobFiles;
+      last_job.JobBytes = jcr->JobBytes;
+      last_job.JobStatus = jcr->JobStatus;
+      last_job.JobLevel = jcr->JobLevel;
+      last_job.start_time = jcr->start_time;
+      last_job.end_time = time(NULL);
+      /* Keep list of last jobs, but not Console where JobId==0 */
+      if (last_job.JobId > 0) {
+         je = (struct s_last_job *)malloc(sizeof(struct s_last_job));
+         memcpy((char *)je, (char *)&last_job, sizeof(last_job));
+         if (!last_jobs) {
+            init_last_jobs_list();
+         }
+         last_jobs->append(je);
+         if (last_jobs->size() > max_last_jobs) {
+            je = (struct s_last_job *)last_jobs->first();
+            last_jobs->remove(je);
+            free(je);
+         }
+      }
+      break;
+   default:
+      break;
+
+   }
    if (jcr->daemon_free_jcr) {
       jcr->daemon_free_jcr(jcr);      /* call daemon free routine */
    }
+
+   unlock_jcr_chain();
    free_common_jcr(jcr);
    close_msg(NULL);                   /* flush any daemon messages */
    garbage_collect_memory_pool();
index e18d41c7eedbedab55f8c950d1ce8e3f687ace51..c3fc476925c169eebae2925b5b6c9b83bab0659e 100644 (file)
@@ -406,5 +406,9 @@ void stored_free_jcr(JCR *jcr)
       jcr->write_store = NULL;
    }
    Dsm_check(1);
+
+   if (jcr->JobId != 0)
+      write_state_file(me->working_directory, "bacula-sd", get_first_port_host_order(me->sdaddrs));
+
    return;
 }
index dce0a134c71ca7891701f262440136c57da98b07..8ccd5d54b445d2a16bfa01213905a147fe0b355f 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "2.3.9"
-#define BDATE   "05 February 2008"
-#define LSMDATE "05Feb08"
+#define BDATE   "08 February 2008"
+#define LSMDATE "08Feb08"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2008"       /* year for copyright messages in progs */
index a02110530865feaacf33ff01dc372c2bf319ac66..885bb69fad4e2e52c5aa65de5e83ddf25c13c698 100644 (file)
@@ -1,6 +1,13 @@
               Technical notes on version 2.3
 
 General:
+08Feb08
+kes  Apply patch from Peter Much <pmc@citylink.dinoex.sub.org> that fixes
+     a resource embedded run command to find a since time if no explicit
+     since time was supplied on the command line.
+kes  Apply state-file.patch sent by Allan Black <Allan.Black@btconnect.com>
+     that updates the state file at job termination time in addition to
+     when the daemon terminates.
 05Feb08
 kes  First version where a plugin did a backup.
      bpipe-fd.so created a backup file, wrote a test