]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Create and apply 2.4.3-migrate2.patch, which fixes two bugs
authorKern Sibbald <kern@sibbald.com>
Sat, 13 Dec 2008 20:20:22 +0000 (20:20 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 13 Dec 2008 20:20:22 +0000 (20:20 +0000)
     - Bug #1206 -- sql error when there are no files to migrate.
     - Bug #1171 -- Job catalog log is not migrated during migration.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.4@8153 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/patches/2.4.3-migrate2.patch [new file with mode: 0644]
bacula/src/dird/migrate.c
bacula/src/version.h
bacula/technotes-2.4

diff --git a/bacula/patches/2.4.3-migrate2.patch b/bacula/patches/2.4.3-migrate2.patch
new file mode 100644 (file)
index 0000000..9d37e8c
--- /dev/null
@@ -0,0 +1,85 @@
+
+ This patch should fix two bugs: 
+ - Bug #1206 -- sql error when there are no files to migrate. 
+ - Bug #1171 -- Job catalog log is not migrated during migration.
+
+ Apply it to a fully patched (requires two previous migration patches)
+ 2.4.3 version  with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.3-migrate2.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/dird/migrate.c
+===================================================================
+--- src/dird/migrate.c (revision 8152)
++++ src/dird/migrate.c (working copy)
+@@ -122,6 +122,12 @@
+    Dmsg2(dbglevel, "Read pool=%s (From %s)\n", jcr->rpool->name(), jcr->rpool_source);
++   if (!get_or_create_fileset_record(jcr)) {
++      Dmsg1(dbglevel, "JobId=%d no FileSet\n", (int)jcr->JobId);
++      Jmsg(jcr, M_FATAL, 0, _("Could not get or create the FileSet record.\n"));
++      return false;
++   }
++
+    /* If we find a job or jobs to migrate it is previous_jr.JobId */
+    count = get_job_to_migrate(jcr);
+    if (count < 0) {
+@@ -139,12 +145,6 @@
+       return true;                    /* no work */
+    }
+-   if (!get_or_create_fileset_record(jcr)) {
+-      Dmsg1(dbglevel, "JobId=%d no FileSet\n", (int)jcr->JobId);
+-      Jmsg(jcr, M_FATAL, 0, _("Could not get or create the FileSet record.\n"));
+-      return false;
+-   }
+-
+    create_restore_bootstrap_file(jcr);
+    if (jcr->previous_jr.JobId == 0 || jcr->ExpectedFiles == 0) {
+@@ -1062,6 +1062,11 @@
+     *  mig_jcr is jcr of the newly migrated job.
+     */
+    if (mig_jcr) {
++      char old_jobid[50], new_jobid[50];
++
++      edit_uint64(jcr->previous_jr.JobId, old_jobid);
++      edit_uint64(mig_jcr->jr.JobId, new_jobid);
++
+       mig_jcr->JobFiles = jcr->JobFiles = jcr->SDJobFiles;
+       mig_jcr->JobBytes = jcr->JobBytes = jcr->SDJobBytes;
+       mig_jcr->VolSessionId = jcr->VolSessionId;
+@@ -1076,7 +1081,7 @@
+                   "JobTDate=%s WHERE JobId=%s", 
+          jcr->previous_jr.cStartTime, jcr->previous_jr.cEndTime, 
+          edit_uint64(jcr->previous_jr.JobTDate, ec1),
+-         edit_uint64(mig_jcr->jr.JobId, ec2));
++         new_jobid);
+       db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL);
+       /*
+@@ -1086,15 +1091,13 @@
+        *   - Purge the File records from the previous job
+        */
+       if (jcr->JobType == JT_MIGRATE && jcr->JobStatus == JS_Terminated) {
+-         char old_jobid[50], new_jobid[50];
+          Mmsg(query, "UPDATE Job SET Type='%c' WHERE JobId=%s",
+-              (char)JT_MIGRATED_JOB, edit_uint64(jcr->previous_jr.JobId, new_jobid));
++              (char)JT_MIGRATED_JOB, old_jobid);
+          db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL);
+          UAContext *ua = new_ua_context(jcr);
+          /* Move JobLog to new JobId */
+          Mmsg(query, "UPDATE Log SET JobId=%s WHERE JobId=%s",
+-           new_jobid,
+-           edit_uint64(jcr->previous_jr.JobId, old_jobid));
++           new_jobid, old_jobid);
+          db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL);
+          /* Purge all old file records, but leave Job record */
+          purge_files_from_jobs(ua, old_jobid);
index 1c695e2033221d36bab7e66a3cd25b6e70654987..c3aab9ed2748b80cf7daed3a530e263bea3cb05f 100644 (file)
@@ -122,6 +122,12 @@ bool do_migration_init(JCR *jcr)
 
    Dmsg2(dbglevel, "Read pool=%s (From %s)\n", jcr->rpool->name(), jcr->rpool_source);
 
+   if (!get_or_create_fileset_record(jcr)) {
+      Dmsg1(dbglevel, "JobId=%d no FileSet\n", (int)jcr->JobId);
+      Jmsg(jcr, M_FATAL, 0, _("Could not get or create the FileSet record.\n"));
+      return false;
+   }
+
    /* If we find a job or jobs to migrate it is previous_jr.JobId */
    count = get_job_to_migrate(jcr);
    if (count < 0) {
@@ -139,12 +145,6 @@ bool do_migration_init(JCR *jcr)
       return true;                    /* no work */
    }
 
-   if (!get_or_create_fileset_record(jcr)) {
-      Dmsg1(dbglevel, "JobId=%d no FileSet\n", (int)jcr->JobId);
-      Jmsg(jcr, M_FATAL, 0, _("Could not get or create the FileSet record.\n"));
-      return false;
-   }
-
    create_restore_bootstrap_file(jcr);
 
    if (jcr->previous_jr.JobId == 0 || jcr->ExpectedFiles == 0) {
@@ -1062,6 +1062,11 @@ void migration_cleanup(JCR *jcr, int TermCode)
     *  mig_jcr is jcr of the newly migrated job.
     */
    if (mig_jcr) {
+      char old_jobid[50], new_jobid[50];
+
+      edit_uint64(jcr->previous_jr.JobId, old_jobid);
+      edit_uint64(mig_jcr->jr.JobId, new_jobid);
+
       mig_jcr->JobFiles = jcr->JobFiles = jcr->SDJobFiles;
       mig_jcr->JobBytes = jcr->JobBytes = jcr->SDJobBytes;
       mig_jcr->VolSessionId = jcr->VolSessionId;
@@ -1076,7 +1081,7 @@ void migration_cleanup(JCR *jcr, int TermCode)
                   "JobTDate=%s WHERE JobId=%s", 
          jcr->previous_jr.cStartTime, jcr->previous_jr.cEndTime, 
          edit_uint64(jcr->previous_jr.JobTDate, ec1),
-         edit_uint64(mig_jcr->jr.JobId, ec2));
+         new_jobid);
       db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL);
 
       /*
@@ -1086,15 +1091,13 @@ void migration_cleanup(JCR *jcr, int TermCode)
        *   - Purge the File records from the previous job
        */
       if (jcr->JobType == JT_MIGRATE && jcr->JobStatus == JS_Terminated) {
-         char old_jobid[50], new_jobid[50];
          Mmsg(query, "UPDATE Job SET Type='%c' WHERE JobId=%s",
-              (char)JT_MIGRATED_JOB, edit_uint64(jcr->previous_jr.JobId, new_jobid));
+              (char)JT_MIGRATED_JOB, old_jobid);
          db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL);
          UAContext *ua = new_ua_context(jcr);
          /* Move JobLog to new JobId */
          Mmsg(query, "UPDATE Log SET JobId=%s WHERE JobId=%s",
-           new_jobid,
-           edit_uint64(jcr->previous_jr.JobId, old_jobid));
+           new_jobid, old_jobid);
          db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL);
          /* Purge all old file records, but leave Job record */
          purge_files_from_jobs(ua, old_jobid);
index 34b5e68539a4c6410321e0a624c698a1f05bfd81..3eadafed6b54676e0304333cb6ff2c92fffa6b27 100644 (file)
@@ -3,9 +3,9 @@
  */
 
 #undef  VERSION
-#define VERSION "2.4.4-b1"
-#define BDATE   "03 December 2008"
-#define LSMDATE "03Dec08"
+#define VERSION "2.4.4-b2"
+#define BDATE   "13 December 2008"
+#define LSMDATE "13Dec08"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2008"       /* year for copyright messages in progs */
index 3d299153243902dbfecdca41c43a828118d7ec5f..cd6d6eb2ec7aac28e86ca141c57daaf9ea197ec4 100644 (file)
@@ -1,6 +1,10 @@
               Technical notes on version 2.4
 
 General:
+13Dec08
+kes  Create and apply 2.4.3-migrate2.patch, which fixes two bugs
+     - Bug #1206 -- sql error when there are no files to migrate.
+     - Bug #1171 -- Job catalog log is not migrated during migration.
 03Dec08
 kes  Apply 2.4.3-sd-deadlock.patch that should fix bug #1192.
 02Dec08