From 00b221dd3aebdc6834e35b9fe0a63d0bcf6d7912 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 3 May 2014 12:06:49 +0200 Subject: [PATCH] Reschedule on error caused EndTime to be incorrect -- fixes bug #2029 --- bacula/src/cats/sql_update.c | 4 ++-- bacula/src/dird/jobq.c | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) 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 */ -- 2.39.5