From: Kern Sibbald Date: Sun, 5 Sep 2004 06:52:31 +0000 (+0000) Subject: - Send all queued messages in SD and FD prior to closing down X-Git-Tag: Release-1.35.3~8 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6235f07b8d07b82447fd49c6b4e072b829ea4b8f;p=bacula%2Fbacula - Send all queued messages in SD and FD prior to closing down 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 --- diff --git a/bacula/kernstodo b/bacula/kernstodo index 88dcf7f2e5..2b3a1cc32d 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -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. diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index 623755c7fd..11ddbab5ac 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -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); diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 1b3064ba31..148f9ff54a 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -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) { diff --git a/bacula/src/dird/restore.c b/bacula/src/dird/restore.c index e8b0da28f2..731dad3ca6 100644 --- a/bacula/src/dird/restore.c +++ b/bacula/src/dird/restore.c @@ -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); diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 94b0f57389..997eff3e59 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -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); diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index d9a43a7659..0f590305a3 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -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, "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); diff --git a/bacula/src/lib/alist.c b/bacula/src/lib/alist.c index d82c45ed74..dc01ccf9f7 100644 --- a/bacula/src/lib/alist.c +++ b/bacula/src/lib/alist.c @@ -145,9 +145,11 @@ void alist::destroy() if (own_items) { for (int i=0; iinit(num, own); + init(num, own); +} + +/* Destructor */ +inline alist::~alist() { + destroy(); } diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index 500c8485cd..7adddf5465 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -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, "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; diff --git a/bacula/src/stored/fd_cmds.c b/bacula/src/stored/fd_cmds.c index 3dd28588e9..39961dbfae 100644 --- a/bacula/src/stored/fd_cmds.c +++ b/bacula/src/stored/fd_cmds.c @@ -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));