"WHERE File.FileIndex > 0 ORDER BY JobId, FileIndex ASC",/* Return sorted by JobId, */
/* FileIndex for restore code */
jobids, jobids);
- Dmsg1(0, "q=%s\n", buf.c_str());
#else
/*
* I am not sure that this works the same as the code in ua_restore.c
/* build a jobid list ie: 1,2,3,4 */
Mmsg(query, "SELECT JobId FROM btemp3%s ORDER by JobTDate", jobid);
db_sql_query(mdb, query.c_str(), db_get_int_handler, jobids);
- Dmsg1(1, "db_accurate_get_jobids=%s\n", jobids);
+ Dmsg1(10, "db_accurate_get_jobids=%s\n", jobids);
ret = true;
bail_out:
// edit_uint64(jr->FileSetId, filesetid));
date);
- Dmsg1(1, "db_get_base_jobid q=%s\n", query.c_str());
+ Dmsg1(10, "db_get_base_jobid q=%s\n", query.c_str());
if (!db_sql_query(mdb, query.c_str(), db_int64_handler, &id)) {
goto bail_out;
}
*jobid = (JobId_t) id;
- Dmsg1(1, "db_get_base_jobid=%lld\n", id);
+ Dmsg1(10, "db_get_base_jobid=%lld\n", id);
return true;
bail_out:
for (TREE_NODE *node=first_tree_node(tree.root); node; node=next_tree_node(node)) {
Dmsg2(400, "FI=%d node=0x%x\n", node->FileIndex, node);
if (node->extract || node->extract_dir) {
- Dmsg2(400, "type=%d FI=%d\n", node->type, node->FileIndex);
+ Dmsg3(0, "JobId=%lld type=%d FI=%d\n", (uint64_t)node->JobId, node->type, node->FileIndex);
add_findex(rx->bsr, node->JobId, node->FileIndex);
if (node->extract && node->type != TN_NEWDIR) {
rx->selected_files++; /* count only saved files */
--- /dev/null
+#!/bin/sh
+#
+# Run a basejob backup of the Bacula build directory
+# then restore it.
+#
+
+TestName="base-job-test"
+JobName=backup
+. scripts/functions
+$rscripts/cleanup
+
+copy_test_confs
+sed 's/backup_advance/base_backup/' $rscripts/bacula-dir.conf.accurate > $tmp/1
+sed 's/Name = backup/Name = backup; Base = base_backup/' $tmp/1 > $conf/bacula-dir.conf
+sed s/all,/all,saved,/ $conf/bacula-fd.conf > tmp/1
+cp tmp/1 $conf/bacula-fd.conf
+
+change_jobname BackupClient1 $JobName
+
+p() {
+ echo "##############################################" >> ${cwd}/tmp/log1.out
+ echo "$*" >> ${cwd}/tmp/log1.out
+ echo "##############################################" >> ${cwd}/tmp/log2.out
+ echo "$*" >> ${cwd}/tmp/log2.out
+}
+
+# cleanup
+rm -rf ${cwd}/build/accurate.new
+rm -rf ${cwd}/build/accurate
+
+
+# add extra files
+mkdir ${cwd}/build/accurate
+mkdir ${cwd}/build/accurate/dirtest
+echo "test test" > ${cwd}/build/accurate/dirtest/hello
+echo "test test" > ${cwd}/build/accurate/xxx
+echo "test test" > ${cwd}/build/accurate/yyy
+echo "test test" > ${cwd}/build/accurate/zzz
+echo "test test" > ${cwd}/build/accurate/zzzzzz
+echo "test test" > ${cwd}/build/accurate/xxxxxx
+echo "test test" > ${cwd}/build/accurate/yyyyyy
+echo "test test" > ${cwd}/build/accurate/xxxxxxxxx
+echo "test test" > ${cwd}/build/accurate/yyyyyyyyy
+echo "test test" > ${cwd}/build/accurate/zzzzzzzzz
+echo ${cwd}/build > ${cwd}/tmp/file-list
+
+start_test
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@output /dev/null
+messages
+label volume=TestVolume001 storage=File pool=Default
+messages
+END_OF_DATA
+
+run_bacula
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out ${cwd}/tmp/log1.out
+run job=backup level=full yes
+wait
+messages
+@#
+@# now do a restore
+@#
+@$out ${cwd}/tmp/log2.out
+restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
+yes
+wait
+messages
+@$out
+END_OF_DATA
+
+################################################################
+p First : We just run a full backup and restore
+################################################################
+
+run_bconsole
+check_for_zombie_jobs storage=File
+
+check_two_logs
+check_restore_diff
+
+rm -rf ${cwd}/tmp/bacula-restores
+
+################################################################
+p Now do a second backup using base backup
+################################################################
+
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out ${cwd}/tmp/log1.out
+run job=base_backup level=base yes
+wait
+messages
+update volume=TestVolume001 volstatus=Used
+label volume=TestVolume002 storage=File pool=Default
+run job=backup level=full yes
+wait
+messages
+@#
+@# now do a restore
+@#
+@$out ${cwd}/tmp/log2.out
+restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
+yes
+wait
+messages
+END_OF_DATA
+
+
+run_bconsole
+check_for_zombie_jobs storage=File
+
+check_two_logs
+check_restore_diff
+
+rm -rf ${cwd}/tmp/bacula-restores
+
+################################################################
+p Now do a third backup after making few changes
+################################################################
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+@$out ${cwd}/tmp/log1.out
+run job=backup level=incremental yes
+wait
+messages
+@#
+@# now do a restore
+@#
+@$out ${cwd}/tmp/log2.out
+restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
+yes
+wait
+messages
+END_OF_DATA
+
+rm ${cwd}/build/accurate/yyyyyy # delete a file
+rmdir ${cwd}/build/accurate/dirtest
+
+
+run_bconsole
+check_for_zombie_jobs storage=File
+
+check_two_logs
+check_restore_diff
+check_files_written ${cwd}/tmp/log1.out 3
+
+rm -rf ${cwd}/tmp/bacula-restores
+
+stop_bacula
+end_test