From fc23e332c9383072cdeee1b43af39f533ca47d86 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 5 Jun 2009 17:05:49 +0000 Subject: [PATCH] Improve error messages when a migration sql query is used and correct the problem identified in bug #1303 with starting Job names containing spaces. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8888 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/dird/migrate.c | 14 ++++++++++---- bacula/src/version.h | 4 ++-- bacula/technotes | 3 +++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index afb8606200..b8fb64d89e 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -481,6 +481,12 @@ static int unique_dbid_handler(void *ctx, int num_fields, char **row) { idpkt *ids = (idpkt *)ctx; + /* Sanity check */ + if (!row || !row[0]) { + Dmsg0(dbglevel, "dbid_hdlr error empty row\n"); + return 1; /* stop calling us */ + } + add_unique_id(ids, row[0]); Dmsg3(dbglevel, "dbid_hdlr count=%d Ids=%p %s\n", ids->count, ids->list, ids->list); return 0; @@ -847,9 +853,6 @@ static int get_job_to_migrate(JCR *jcr) JobId = 0; stat = get_next_jobid_from_list(&p, &JobId); Dmsg3(dbglevel, "get_jobid_no=%d stat=%d JobId=%u\n", i, stat, JobId); - jcr->MigrateJobId = JobId; - start_migration_job(jcr); - Dmsg0(dbglevel, "Back from start_migration_job\n"); if (stat < 0) { Jmsg(jcr, M_FATAL, 0, _("Invalid JobId found.\n")); goto bail_out; @@ -857,6 +860,9 @@ static int get_job_to_migrate(JCR *jcr) Jmsg(jcr, M_INFO, 0, _("No JobIds found to %s.\n"), jcr->get_ActionName(0)); goto ok_out; } + jcr->MigrateJobId = JobId; + start_migration_job(jcr); + Dmsg0(dbglevel, "Back from start_migration_job\n"); } /* Now get the last JobId and handle it in the current job */ @@ -908,7 +914,7 @@ static void start_migration_job(JCR *jcr) UAContext *ua = new_ua_context(jcr); char ed1[50]; ua->batch = true; - Mmsg(ua->cmd, "run %s jobid=%s", jcr->job->hdr.name, + Mmsg(ua->cmd, "run job=\"%s\" jobid=%s", jcr->job->name(), edit_uint64(jcr->MigrateJobId, ed1)); Dmsg2(dbglevel, "=============== %s cmd=%s\n", jcr->get_OperationName(), ua->cmd); parse_ua_args(ua); /* parse command */ diff --git a/bacula/src/version.h b/bacula/src/version.h index 978ca59454..f8ed5ab082 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "3.0.2" -#define BDATE "25 May 2009" -#define LSMDATE "25May09" +#define BDATE "05 June 2009" +#define LSMDATE "05Jun09" #define PROG_COPYRIGHT "Copyright (C) %d-2009 Free Software Foundation Europe e.V.\n" #define BYEAR "2009" /* year for copyright messages in progs */ diff --git a/bacula/technotes b/bacula/technotes index a8d213dfa3..b17d835755 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -3,6 +3,9 @@ General: 05Jun09 +kes Improve error messages when a migration sql query is used and correct + the problem identified in bug #1303 with starting Job names + containing spaces. ebl Fix #1306 about a problem when building the static bconsole 26May09 ebl Apply Steve Polyack patch to add DirSourceAddress and FDSourceAddress -- 2.39.5