From 31d0673dbcc20e5d108ccae2f6bebc25e303682a Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 26 Jul 2008 20:52:58 +0000 Subject: [PATCH] kes When a migration job actually runs, re-check the Job record and skip if the job is already migrated. This should significantly reduce the problems with bug #1129. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7440 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/dird/migrate.c | 21 +++++++++++++++------ bacula/technotes-2.5 | 4 ++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index 347c3840fe..07d90fe75d 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -164,10 +164,6 @@ bool do_migration_init(JCR *jcr) return true; /* no work */ } - Dmsg5(dbglevel, "JobId=%d: Previous: Name=%s JobId=%d Type=%c Level=%c\n", - (int)jcr->JobId, - jcr->previous_jr.Name, (int)jcr->previous_jr.JobId, - jcr->previous_jr.JobType, jcr->previous_jr.JobLevel); Dmsg5(dbglevel, "JobId=%d: Current: Name=%s JobId=%d Type=%c Level=%c\n", (int)jcr->JobId, @@ -280,13 +276,26 @@ bool do_migration(JCR *jcr) return true; } + if (!db_get_job_record(jcr, jcr->db, &jcr->previous_jr)) { + Jmsg(jcr, M_FATAL, 0, _("Could not get job record for JobId %s to migrate. ERR=%s"), + edit_int64(jcr->previous_jr.JobId, ed1), + db_strerror(jcr->db)); + set_jcr_job_status(jcr, JS_Terminated); + migration_cleanup(jcr, jcr->JobStatus); + return true; + } + /* Make sure this job was not already migrated */ + if (jcr->previous_jr.JobType != JT_BACKUP) { + set_jcr_job_status(jcr, JS_Terminated); + migration_cleanup(jcr, jcr->JobStatus); + return true; + } + /* Print Job Start message */ Jmsg(jcr, M_INFO, 0, _("Start %s JobId %s, Job=%s\n"), jcr->get_JobType() == JT_MIGRATE ? "Migration" : "Copy", edit_uint64(jcr->JobId, ed1), jcr->Job); - - /* * Open a message channel connection with the Storage * daemon. This is to let him know that our client diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index b7c40cef4f..a050cb93e8 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -32,6 +32,10 @@ separator in console (!$%&'()*+,-/:;<>?[]^`{|}~) General: +26Jul08 +kes When a migration job actually runs, re-check the Job record + and skip if the job is already migrated. This should + significantly reduce the problems with bug #1129. 24Jul08 kes Set MALLOC_CHECK_=0 in environment before starting Bacula to turn off glibc checks that prevent getting good dumps. -- 2.39.5