From: Kern Sibbald Date: Mon, 21 Feb 2011 17:28:42 +0000 (+0100) Subject: Tweak restart incomplete jobs X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0442327ee226064eea9721edb954d941b9f1d2b0;p=bacula%2Fbacula Tweak restart incomplete jobs --- 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()); }