From: Kern Sibbald Date: Fri, 1 Dec 2006 20:31:59 +0000 (+0000) Subject: Do not update Migrated Job type if migration does not terminate X-Git-Tag: Release-2.0.0~187 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=834f8f013453d84d7c11a44e560b5f7e0ebc0980;p=bacula%2Fbacula 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 --- 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.