]> git.sur5r.net Git - bacula/bacula/commitdiff
Tweak restart base
authorKern Sibbald <kern@sibbald.com>
Mon, 21 Feb 2011 10:59:15 +0000 (11:59 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:43:26 +0000 (14:43 +0200)
bacula/src/dird/backup.c
regress/tests/restart-base-job-test [new file with mode: 0755]

index f978df13bb6af832492f9bad814449b0401867e9..3a88ed152e38c796655056ccdd30a969c9a4f187 100644 (file)
@@ -332,8 +332,13 @@ bool do_backup(JCR *jcr)
    }
 
    /* Print Job Start message */
-   Jmsg(jcr, M_INFO, 0, _("Start Backup JobId %s, Job=%s\n"),
-        edit_uint64(jcr->JobId, ed1), jcr->Job);
+   if (jcr->incomplete) {
+      Jmsg(jcr, M_INFO, 0, _("Restart Incomplete Backup JobId %s, Job=%s\n"),
+           edit_uint64(jcr->JobId, ed1), jcr->Job);
+   } else {
+      Jmsg(jcr, M_INFO, 0, _("Start Backup JobId %s, Job=%s\n"),
+           edit_uint64(jcr->JobId, ed1), jcr->Job);
+   }
 
    jcr->setJobStatus(JS_Running);
    Dmsg2(100, "JobId=%d JobLevel=%c\n", jcr->jr.JobId, jcr->jr.JobLevel);
diff --git a/regress/tests/restart-base-job-test b/regress/tests/restart-base-job-test
new file mode 100755 (executable)
index 0000000..3dce0d2
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Run a backup of the build directory but force it to have
+#   a comm error, and check that it restarts correctly.
+#
+TestName="restart-base-job-test"
+JobName=RestartJobWithBase
+. scripts/functions
+
+scripts/cleanup
+scripts/copy-test-confs
+echo "${cwd}/build" >${cwd}/tmp/file-list
+
+change_jobname NightlySave $JobName
+
+$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Base', 'RestartJob', 'Job', 'RestartJob')"
+$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Accurate', 'yes', 'Job', 'RestartJob')"
+start_test
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
+messages
+@$out ${cwd}/tmp/log1.out
+label storage=File volume=TestVolume001
+run job=$JobName level=Base yes
+wait
+messages
+@exec "touch $cwd/build/po/fr.po"
+setdebug level=0 trace=0 hangup=100 client
+@#setdebug level=20 dir
+run job=$JobName yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula  
+
+scripts/check_for_zombie_jobs storage=File
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out /dev/null
+messages
+@# 
+@# now do a restore
+@#
+@$out ${cwd}/tmp/log2.out
+restore where=$tmp/bacula-restores storage=File select all done
+yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+scripts/check_for_zombie_jobs storage=File
+stop_bacula
+
+check_two_logs
+check_restore_diff
+end_test