From: Kern Sibbald Date: Sat, 3 May 2014 10:06:49 +0000 (+0200) Subject: Reschedule on error caused EndTime to be incorrect -- fixes bug #2029 X-Git-Tag: Release-7.0.3~10 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=00b221dd3aebdc6834e35b9fe0a63d0bcf6d7912;p=bacula%2Fbacula Reschedule on error caused EndTime to be incorrect -- fixes bug #2029 --- diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index 302d5e2337..a6c6baab82 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -164,8 +164,8 @@ db_update_job_end_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr) ttime = jr->EndTime; (void)localtime_r(&ttime, &tm); strftime(dt, sizeof(dt), "%Y-%m-%d %H:%M:%S", &tm); - - if (jr->RealEndTime == 0) { + + if (jr->RealEndTime == 0 || jr->RealEndTime < jr->EndTime) { jr->RealEndTime = jr->EndTime; } ttime = jr->RealEndTime; diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index e9f9343711..f28c68124c 100644 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -653,6 +653,11 @@ static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je) if (jcr->wasVirtualFull) { jcr->setJobLevel(L_VIRTUAL_FULL); } + /* + * When we are using the same jcr then make sure to reset + * RealEndTime back to zero. + */ + jcr->jr.RealEndTime = 0; jobq_add(jq, jcr); /* queue the job to run again */ P(jq->mutex); free_jcr(jcr); /* release jcr */