From f1e21f1b2645fb8e39c60cb663a37577ee25c49c Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 8 Jun 2009 07:23:30 +0000 Subject: [PATCH] Commit migrate patch for bug #1303 git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8889 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/patches/3.0.1-migrate-sql.patch | 63 ++++++++++++++++++++++++++ bacula/technotes | 2 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 bacula/patches/3.0.1-migrate-sql.patch diff --git a/bacula/patches/3.0.1-migrate-sql.patch b/bacula/patches/3.0.1-migrate-sql.patch new file mode 100644 index 0000000000..9e7356301c --- /dev/null +++ b/bacula/patches/3.0.1-migrate-sql.patch @@ -0,0 +1,63 @@ + + This patch can be applied to version 3.0.1 and should improve + error messages when a migration sql query is used and correct + the problem identified in bug #1303 with starting Job names + containing spaces. + + Apply it to version 3.0.1 with: + + cd + patch -p0 <3.0.1-migrate-sql.patch + ./configure + make + ... + make install + + + +Index: src/dird/migrate.c +=================================================================== +--- src/dird/migrate.c (revision 8887) ++++ src/dird/migrate.c (working copy) +@@ -481,6 +481,12 @@ + { + 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 @@ + 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 @@ + 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 @@ + 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/technotes b/bacula/technotes index b17d835755..d3ba9c0381 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -3,7 +3,7 @@ General: 05Jun09 -kes Improve error messages when a migration sql query is used and correct +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 -- 2.39.5