From aacf22b6b9265ca8791a53348b9b9bc1cb593419 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 21 Feb 2011 11:30:57 +0100 Subject: [PATCH] Rework Incomplete job intereaction with Base and Accurate --- bacula/src/dird/backup.c | 44 +++++++++++++++++++------------------- bacula/src/dird/jobq.c | 3 ++- bacula/src/stored/append.c | 5 +++-- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index d188e375cb..f978df13bb 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -242,36 +242,36 @@ bool send_accurate_current_files(JCR *jcr) db_list_ctx nb; char ed1[50]; + /* In base level, no previous job is used and no restart incomplete jobs */ + if (jcr->is_canceled() || jcr->is_JobLevel(L_BASE)) { + return true; + } + if (!jcr->accurate && !jcr->incomplete) { + return true; + } + /* For incomplete Jobs, we add our own id */ if (jcr->incomplete) { edit_int64(jcr->JobId, ed1); jobids.add(ed1); - } else { - if (!jcr->accurate || job_canceled(jcr)) { - return true; - } - /* In base level, no previous job is used */ - if (jcr->is_JobLevel(L_BASE)) { + } + + if (jcr->is_JobLevel(L_FULL)) { + /* On Full mode, if no previous base job, no accurate things */ + if (!get_base_jobids(jcr, &jobids) && !jcr->incomplete) { return true; } - - if (jcr->is_JobLevel(L_FULL)) { - /* On Full mode, if no previous base job, no accurate things */ - if (!get_base_jobids(jcr, &jobids)) { - return true; - } - jcr->HasBase = true; - Jmsg(jcr, M_INFO, 0, _("Using BaseJobId(s): %s\n"), jobids.list); + jcr->HasBase = true; + Jmsg(jcr, M_INFO, 0, _("Using BaseJobId(s): %s\n"), jobids.list); - } else { - /* For Incr/Diff level, we search for older jobs */ - db_accurate_get_jobids(jcr, jcr->db, &jcr->jr, &jobids); + } else { + /* For Incr/Diff level, we search for older jobs */ + db_accurate_get_jobids(jcr, jcr->db, &jcr->jr, &jobids); - /* We are in Incr/Diff, but no Full to build the accurate list... */ - if (jobids.count == 0) { - Jmsg(jcr, M_FATAL, 0, _("Cannot find previous jobids.\n")); - return false; /* fail */ - } + /* We are in Incr/Diff, but no Full to build the accurate list... */ + if (jobids.count == 0) { + Jmsg(jcr, M_FATAL, 0, _("Cannot find previous jobids.\n")); + return false; /* fail */ } } diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index 7ceeb86f3e..a94235a234 100644 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -622,7 +622,8 @@ static bool reschedule_job(JCR *jcr, jobq_t *jq, jobq_item_t *je) resched = /* Check for incomplete jobs */ (jcr->job->RescheduleIncompleteJobs && - jcr->is_incomplete() && jcr->is_JobType(JT_BACKUP)) || + jcr->is_incomplete() && jcr->is_JobType(JT_BACKUP) && + !jcr->is_JobLevel(L_BASE)) || /* Check for failed jobs */ (jcr->job->RescheduleOnError && !jcr->is_JobStatus(JS_Terminated) && diff --git a/bacula/src/stored/append.c b/bacula/src/stored/append.c index 8cdc8b42d8..72bf6ab1ac 100644 --- a/bacula/src/stored/append.c +++ b/bacula/src/stored/append.c @@ -55,9 +55,10 @@ void possible_incomplete_job(JCR *jcr, int32_t last_file_index) * for a production system, we probably want something like * 100-1000 files, and some number of bytes of data. * - * ****FIXME**** update this + * ****FIXME**** set last_file_index to something more + * reasonable, and maybe check JobBytes. */ - if (last_file_index > 10) { + if (jcr->spool_attributes && last_file_index > 10) { jcr->setJobStatus(JS_Incomplete); } } -- 2.39.5