]> git.sur5r.net Git - bacula/bacula/commitdiff
- Send all queued messages in SD and FD prior to closing down
authorKern Sibbald <kern@sibbald.com>
Sun, 5 Sep 2004 06:52:31 +0000 (06:52 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 5 Sep 2004 06:52:31 +0000 (06:52 +0000)
  the job.
- Send queued messages in Jobs before terminating the job
  so that the messages print before the job report.
- Add a destructor so that the Console ACLs are properly
  freed.

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

bacula/kernstodo
bacula/src/dird/backup.c
bacula/src/dird/dird_conf.c
bacula/src/dird/restore.c
bacula/src/dird/verify.c
bacula/src/filed/job.c
bacula/src/lib/alist.c
bacula/src/lib/alist.h
bacula/src/stored/dircmd.c
bacula/src/stored/fd_cmds.c

index 88dcf7f2e5c6ed2d61e0a35d8ec25fed4596995b..2b3a1cc32dceaba6c9462630bea31755ac2b9939 100644 (file)
@@ -18,10 +18,8 @@ Version 1.35                Kern (see below)
 - Look at patches/bacula_db.b2z postgresql that loops during restore.
   See Gregory Wright.
 - Perhaps add read/write programs and/or plugins to FileSets.
-- Make sure Qmsgs are dequeued by FD and SD.
-- Check if ACLs allocated at dird_conf.c:1214 are being properly
-  released.
 
+- Add delete JobId to regression.
 - Add bscan to four-concurrent-jobs regression.
 - Add IPv6 to regression
 - Alternative to static linking "ldd prog" save all binaries listed,
@@ -33,6 +31,7 @@ Version 1.35                Kern (see below)
 - Doc update AllFromVol
 - Doc dbcheck eliminate orphaned clients.
 - Doc -p option in stored
+- Doc Phil's new delete job jobid scanning code.
 - Document that console commands can be abbreviated.
 - New IP address specification is used as follows:
     [sdaddresses|diraddresses|fdaddresses] = { [[ip|ipv4|ipv6] = { 
@@ -1296,4 +1295,7 @@ Block Position: 0
 - Implement Ignore FileSet Change.
 - Doc new duration time input editing.
 - Bacula rescue CDROM implement isolinux
+- Make sure Qmsgs are dequeued by FD and SD.
+- Check if ACLs allocated at dird_conf.c:1214 are being properly
+  released.
  
index 623755c7fdb8025e32312675053b4882a8742f54..11ddbab5acdcc6fe0e1f7ef5a382640ad42120ae 100644 (file)
@@ -293,6 +293,7 @@ static void backup_cleanup(JCR *jcr, int TermCode, char *since, FILESET_DBR *fsr
    utime_t RunTime;
 
    Dmsg2(100, "Enter backup_cleanup %d %c\n", TermCode, TermCode);
+   dequeue_messages(jcr);            /* display any queued messages */
    memset(&mr, 0, sizeof(mr));
    set_jcr_job_status(jcr, TermCode);
 
index 1b3064ba3123ab4a85d4f48fdb311bd7135a9d1e..148f9ff54a090c6bb23331113229dfa693f50f01 100644 (file)
@@ -1209,10 +1209,10 @@ void store_acl(LEX *lc, RES_ITEM *item, int index, int pass)
       if (pass == 1) {
         if (((alist **)item->value)[item->code] == NULL) {   
            ((alist **)item->value)[item->code] = New(alist(10, owned_by_alist)); 
-//          Dmsg1(900, "Defined new ACL alist at %d\n", item->code);
+            Dmsg1(900, "Defined new ACL alist at %d\n", item->code);
         }
         ((alist **)item->value)[item->code]->append(bstrdup(lc->str));
-//       Dmsg2(900, "Appended to %d %s\n", item->code, lc->str);
+         Dmsg2(900, "Appended to %d %s\n", item->code, lc->str);
       }
       token = lex_get_token(lc, T_ALL);
       if (token == T_COMMA) {
index e8b0da28f21723595d820602008ae5e0dacbdbf8..731dad3ca66affd022dc7d48c815aab04b2cd32a 100644 (file)
@@ -272,6 +272,7 @@ static void restore_cleanup(JCR *jcr, int TermCode)
    double kbps;
 
    Dmsg0(20, "In restore_cleanup\n");
+   dequeue_messages(jcr);            /* display any queued messages */
    set_jcr_job_status(jcr, TermCode);
 
    update_job_end_record(jcr);
index 94b0f57389f5de00af5e7a3d61e1e43b9c6809f8..997eff3e5999f67cc17e6987cd352907b63b4c7e 100644 (file)
@@ -367,6 +367,7 @@ static void verify_cleanup(JCR *jcr, int TermCode)
    const char *Name;
 
 // Dmsg1(100, "Enter verify_cleanup() TermCod=%d\n", TermCode);
+   dequeue_messages(jcr);            /* display any queued messages */
 
    JobId = jcr->jr.JobId;
    set_jcr_job_status(jcr, TermCode);
index d9a43a7659e4d6749f8d7de4140f802b998b7c8e..0f590305a3f2804623b13b5fde40b321fc4a5ffb 100644 (file)
@@ -187,37 +187,37 @@ void *handle_client_request(void *dirp)
 
       /* Read command */
       if (bnet_recv(dir) < 0) {
-         break;               /* connection terminated */
+        break;               /* connection terminated */
       }
       dir->msg[dir->msglen] = 0;
       Dmsg1(100, "<dird: %s", dir->msg);
       found = false;
       for (i=0; cmds[i].cmd; i++) {
-         if (strncmp(cmds[i].cmd, dir->msg, strlen(cmds[i].cmd)) == 0) {
-            found = true;         /* indicate command found */
-            if (!jcr->authenticated && cmds[i].func != hello_cmd) {
-               bnet_fsend(dir, no_auth);
-               bnet_sig(dir, BNET_EOD);
-               break;
-            }
-            if ((jcr->authenticated) && (!cmds[i].monitoraccess) && (jcr->director->monitor)) {
+        if (strncmp(cmds[i].cmd, dir->msg, strlen(cmds[i].cmd)) == 0) {
+           found = true;         /* indicate command found */
+           if (!jcr->authenticated && cmds[i].func != hello_cmd) {
+              bnet_fsend(dir, no_auth);
+              bnet_sig(dir, BNET_EOD);
+              break;
+           }
+           if ((jcr->authenticated) && (!cmds[i].monitoraccess) && (jcr->director->monitor)) {
                Dmsg1(100, "Command %s illegal.\n", cmds[i].cmd);
-               bnet_fsend(dir, illegal_cmd);
-               bnet_sig(dir, BNET_EOD);
-               break;
-            }
+              bnet_fsend(dir, illegal_cmd);
+              bnet_sig(dir, BNET_EOD);
+              break;
+           }
             Dmsg1(100, "Executing %s command.\n", cmds[i].cmd);
-            if (!cmds[i].func(jcr)) {         /* do command */
-               quit = true;         /* error or fully terminated,      get out */
+           if (!cmds[i].func(jcr)) {         /* do command */
+              quit = true;         /* error or fully terminated,       get out */
                Dmsg0(20, "Quit command loop due to command error or Job done.\n");
-            }
-            break;
-         }
+           }
+           break;
+        }
       }
-      if (!found) {              /* command not found */
-         bnet_fsend(dir, errmsg);
-         quit = true;
-         break;
+      if (!found) {             /* command not found */
+        bnet_fsend(dir, errmsg);
+        quit = true;
+        break;
       }
    }
 
@@ -229,6 +229,7 @@ void *handle_client_request(void *dirp)
    if (jcr->RunAfterJob && !job_canceled(jcr)) {
       run_cmd(jcr, jcr->RunAfterJob, "ClientRunAfterJob");
    }
+   dequeue_messages(jcr);            /* send any queued messages */
 
    /* Inform Director that we are done */
    bnet_sig(dir, BNET_TERMINATE);
index d82c45ed7481bed89d9677e57189ca26a2c2aa86..dc01ccf9f7a588a1786b6bb6e75f9141cfb8d5db 100644 (file)
@@ -145,9 +145,11 @@ void alist::destroy()
       if (own_items) {
         for (int i=0; i<num_items; i++) {
            free(items[i]);
+           items[i] = NULL;
         }
       }
       free(items);
+      items = NULL;
    }
 }
 
index 49a960c21eed9af8c226a603a085ce8d9134ef91..baeaba3bf1e4db943a5a71a52364510db9f74c43 100644 (file)
@@ -60,6 +60,7 @@ class alist : public SMARTALLOC {
    void grow_list(void);
 public:
    alist(int num = 1, bool own=true);
+   ~alist();
    void init(int num = 1, bool own=true);
    void append(void *item);
    void prepend(void *item);
@@ -103,7 +104,12 @@ inline void alist::init(int num, bool own) {
 
 /* Constructor */
 inline alist::alist(int num, bool own) {
-   this->init(num, own);
+   init(num, own);
+}
+
+/* Destructor */
+inline alist::~alist() {
+   destroy();
 }
    
 
index 500c8485cd7d00695f8b6fd2767dfdc7a3941f82..7adddf5465fd3c1f646f51488dfe17a2f7ca3da2 100644 (file)
@@ -101,7 +101,7 @@ static struct s_cmds cmds[] = {
    {"autochanger", autochanger_cmd, 0},
    {"release",   release_cmd,   0},
    {"readlabel", readlabel_cmd, 0},
-   {NULL,       NULL}                      /* list terminator */
+   {NULL,       NULL}                      /* list terminator */
 };
 
 
@@ -181,32 +181,33 @@ void *handle_connection_request(void *arg)
    for (quit=0; !quit;) {
       /* Read command */
       if ((bnet_stat = bnet_recv(bs)) <= 0) {
-         break;               /* connection terminated */
+        break;               /* connection terminated */
       }
       Dmsg1(9, "<dird: %s\n", bs->msg);
       found = false;
       for (i=0; cmds[i].cmd; i++) {
-        if (strncmp(cmds[i].cmd, bs->msg, strlen(cmds[i].cmd)) == 0) {
-           if ((!cmds[i].monitoraccess) && (jcr->director->monitor)) {
+       if (strncmp(cmds[i].cmd, bs->msg, strlen(cmds[i].cmd)) == 0) {
+          if ((!cmds[i].monitoraccess) && (jcr->director->monitor)) {
               Dmsg1(100, "Command %s illegal.\n", cmds[i].cmd);
-              bnet_fsend(bs, illegal_cmd);
-              bnet_sig(bs, BNET_EOD);
-              break;
-           }
-           if (!cmds[i].func(jcr)) { /* do command */
-              quit = true; /* error, get out */
+             bnet_fsend(bs, illegal_cmd);
+             bnet_sig(bs, BNET_EOD);
+             break;
+          }
+          if (!cmds[i].func(jcr)) { /* do command */
+             quit = true; /* error, get out */
               Dmsg1(90, "Command %s requsts quit\n", cmds[i].cmd);
-           }
-           found = true;            /* indicate command found */
-           break;
-        }
+          }
+          found = true;             /* indicate command found */
+          break;
+       }
       }
       if (!found) {                  /* command not found */
-        bnet_fsend(bs, derrmsg);
-        quit = true;
-        break;
+       bnet_fsend(bs, derrmsg);
+       quit = true;
+       break;
       }
    }
+   dequeue_messages(jcr);            /* send any queued messages */
    bnet_sig(bs, BNET_TERMINATE);
    free_jcr(jcr);
    return NULL;
index 3dd28588e9a8b3dd13aa3100d036c1555615bb83..39961dbfaedfaea11c5a9f02241a8aaec0ba78fe 100644 (file)
@@ -150,6 +150,7 @@ void run_job(JCR *jcr)
    }
    bnet_sig(fd, BNET_TERMINATE);      /* signal to FD job is done */
    jcr->end_time = time(NULL);
+   dequeue_messages(jcr);            /* send any queued messages */
    set_jcr_job_status(jcr, JS_Terminated);
    bnet_fsend(dir, Job_end, jcr->Job, jcr->JobStatus, jcr->JobFiles,
       edit_uint64(jcr->JobBytes, ec1));