From a61bd5d4937078b731331a535a66e0b1f75855c0 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 1 Dec 2006 20:31:59 +0000 Subject: [PATCH] Do not update Migrated Job type if migration does not terminate normally. This fixes bug #719. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3730 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/dird/migrate.c | 12 +++++++----- bacula/technotes-1.39 | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index 36ac5de4f8..aa534382e0 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -999,10 +999,12 @@ void migration_cleanup(JCR *jcr, int TermCode) edit_uint64(mig_jcr->jr.JobId, ec2)); db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL); - /* Now marke the previous job as migrated */ - Mmsg(query, "UPDATE Job SET Type='%c' WHERE JobId=%s", - (char)JT_MIGRATED_JOB, edit_uint64(jcr->previous_jr.JobId, ec1)); - db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL); + /* Now mark the previous job as migrated if it terminated normally */ + if (jcr->JobStatus == JS_Terminated) { + Mmsg(query, "UPDATE Job SET Type='%c' WHERE JobId=%s", + (char)JT_MIGRATED_JOB, edit_uint64(jcr->previous_jr.JobId, ec1)); + db_sql_query(mig_jcr->db, query.c_str(), NULL, NULL); + } if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_WARNING, 0, _("Error getting job record for stats: %s"), @@ -1021,7 +1023,7 @@ void migration_cleanup(JCR *jcr, int TermCode) if (!db_get_job_volume_names(mig_jcr, mig_jcr->db, mig_jcr->jr.JobId, &mig_jcr->VolumeName)) { /* - * Note, if the job has erred, most likely it did not write any + * Note, if the job has failed, most likely it did not write any * tape, so suppress this "error" message since in that case * it is normal. Or look at it the other way, only for a * normal exit should we complain about this error. diff --git a/bacula/technotes-1.39 b/bacula/technotes-1.39 index eedab76861..a03e20e789 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -2,6 +2,8 @@ General: 01Dec06 +kes Do not update Migrated Job type if migration does not terminate + normally. This fixes bug #719. kes Update ReleaseNotes kes Purge Job records from the catalog for Migration. This was not properly done previously. This fixes bug #718. -- 2.39.5