]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/3.0.1-migrate-sql.patch
Merge branch 'master' of ssh://bacula.git.sourceforge.net/gitroot/bacula/bacula
[bacula/bacula] / bacula / patches / 3.0.1-migrate-sql.patch
1
2  This patch can be applied to version 3.0.1 and should improve
3  error messages when a migration sql query is used and correct
4  the problem identified in bug #1303 with starting Job names   
5  containing spaces.
6
7  Apply it to version 3.0.1 with:
8
9  cd <bacula-source>
10  patch -p0 <3.0.1-migrate-sql.patch
11  ./configure <your-options>
12  make
13  ...
14  make install
15
16
17
18 Index: src/dird/migrate.c
19 ===================================================================
20 --- src/dird/migrate.c  (revision 8887)
21 +++ src/dird/migrate.c  (working copy)
22 @@ -481,6 +481,12 @@
23  {
24     idpkt *ids = (idpkt *)ctx;
25  
26 +   /* Sanity check */
27 +   if (!row || !row[0]) {
28 +      Dmsg0(dbglevel, "dbid_hdlr error empty row\n");
29 +      return 1;              /* stop calling us */
30 +   }
31 +
32     add_unique_id(ids, row[0]);
33     Dmsg3(dbglevel, "dbid_hdlr count=%d Ids=%p %s\n", ids->count, ids->list, ids->list);
34     return 0;
35 @@ -847,9 +853,6 @@
36        JobId = 0;
37        stat = get_next_jobid_from_list(&p, &JobId);
38        Dmsg3(dbglevel, "get_jobid_no=%d stat=%d JobId=%u\n", i, stat, JobId);
39 -      jcr->MigrateJobId = JobId;
40 -      start_migration_job(jcr);
41 -      Dmsg0(dbglevel, "Back from start_migration_job\n");
42        if (stat < 0) {
43           Jmsg(jcr, M_FATAL, 0, _("Invalid JobId found.\n"));
44           goto bail_out;
45 @@ -857,6 +860,9 @@
46           Jmsg(jcr, M_INFO, 0, _("No JobIds found to %s.\n"), jcr->get_ActionName(0));
47           goto ok_out;
48        }
49 +      jcr->MigrateJobId = JobId;
50 +      start_migration_job(jcr);
51 +      Dmsg0(dbglevel, "Back from start_migration_job\n");
52     }
53     
54     /* Now get the last JobId and handle it in the current job */
55 @@ -908,7 +914,7 @@
56     UAContext *ua = new_ua_context(jcr);
57     char ed1[50];
58     ua->batch = true;
59 -   Mmsg(ua->cmd, "run %s jobid=%s", jcr->job->hdr.name, 
60 +   Mmsg(ua->cmd, "run job=\"%s\" jobid=%s", jcr->job->name(),
61          edit_uint64(jcr->MigrateJobId, ed1));
62     Dmsg2(dbglevel, "=============== %s cmd=%s\n", jcr->get_OperationName(), ua->cmd);
63     parse_ua_args(ua);                 /* parse command */