From 1c9812fa3054cfc619fb0b36f491d2609028b92e Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 21 Feb 2011 18:28:42 +0100 Subject: [PATCH] Tweak restart incomplete jobs --- bacula/src/dird/backup.c | 25 ++++++++++++++----------- bacula/src/filed/backup.c | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index 3a88ed152e..19d6059263 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -250,20 +250,14 @@ bool send_accurate_current_files(JCR *jcr) return true; } - /* For incomplete Jobs, we add our own id */ - if (jcr->incomplete) { - edit_int64(jcr->JobId, ed1); - jobids.add(ed1); - } - 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) { + if (get_base_jobids(jcr, &jobids)) { + jcr->HasBase = true; + Jmsg(jcr, M_INFO, 0, _("Using BaseJobId(s): %s\n"), jobids.list); + } else if (!jcr->incomplete) { return true; } - 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); @@ -275,6 +269,12 @@ bool send_accurate_current_files(JCR *jcr) } } + /* For incomplete Jobs, we add our own id */ + if (jcr->incomplete) { + edit_int64(jcr->JobId, ed1); + jobids.add(ed1); + } + /* Don't send and store the checksum if fileset doesn't require it */ jcr->use_accurate_chksum = is_checksum_needed_by_fileset(jcr); @@ -351,7 +351,10 @@ bool do_backup(JCR *jcr) if (jcr->incomplete) { edit_int64(jcr->JobId, ed1); Mmsg(buf, "SELECT max(FileIndex) FROM File WHERE JobId=%s", ed1); - if (!db_sql_query(jcr->db, buf.c_str(), db_int64_handler, &job)) { + if (db_sql_query(jcr->db, buf.c_str(), db_int64_handler, &job)) { + Jmsg(jcr, M_INFO, 0, _("Found %ld files from prior incomplete Job.\n"), + (int32_t)job.value); + } else { Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); return false; } diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index e1366f8e8d..7330fde878 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -1162,7 +1162,7 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream) * */ if (!sd->fsend("%ld %d 0", jcr->JobFiles, attr_stream)) { - if (!jcr->is_canceled()) { + if (!jcr->is_canceled() && !jcr->is_incomplete()) { Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), sd->bstrerror()); } -- 2.39.5