From: Eric Bollengier Date: Wed, 29 Jul 2009 21:47:02 +0000 (+0200) Subject: tweak debug X-Git-Tag: Release-5.0.0~365 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ad6adb4ad806f51e66e5ea9898a51dea164b3c6a;p=bacula%2Fbacula tweak debug --- diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 60db400f45..046ce89909 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -1085,7 +1085,6 @@ bool db_get_file_list(JCR *jcr, B_DB *mdb, char *jobids, "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 @@ -1186,7 +1185,7 @@ bool db_accurate_get_jobids(JCR *jcr, B_DB *mdb, /* 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: @@ -1236,13 +1235,13 @@ bool db_get_base_jobid(JCR *jcr, B_DB *mdb, JOB_DBR *jr, JobId_t *jobid) // 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: diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 366d9ed370..0511fe3c6f 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -1158,7 +1158,7 @@ static bool build_directory_tree(UAContext *ua, RESTORE_CTX *rx) 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 */ diff --git a/bacula/src/dird/ua_tree.c b/bacula/src/dird/ua_tree.c index d5580ce313..9ac01a0dc7 100644 --- a/bacula/src/dird/ua_tree.c +++ b/bacula/src/dird/ua_tree.c @@ -198,6 +198,7 @@ int insert_tree_handler(void *ctx, int num_fields, char **row) node = insert_tree_node(row[0], row[1], type, tree->root, NULL); JobId = str_to_int64(row[3]); FileIndex = str_to_int64(row[2]); + Dmsg2(0, "JobId=%s FileIndex=%s\n", row[3], row[2]); /* * - The first time we see a file (node->inserted==true), we accept it. * - In the same JobId, we accept only the first copy of a diff --git a/bacula/src/filed/accurate.c b/bacula/src/filed/accurate.c index 91bc2a4965..92670a5e82 100644 --- a/bacula/src/filed/accurate.c +++ b/bacula/src/filed/accurate.c @@ -111,7 +111,7 @@ static bool accurate_send_base_file_list(JCR *jcr) foreach_htable(elt, jcr->file_list) { if (elt->seen) { - Dmsg2(0, "base file fname=%s seen=%i\n", elt->fname, elt->seen); + Dmsg2(dbglvl, "base file fname=%s seen=%i\n", elt->fname, elt->seen); ff_pkt->fname = elt->fname; ff_pkt->statp.st_mtime = elt->mtime; ff_pkt->statp.st_ctime = elt->ctime; diff --git a/regress/tests/base-job-test b/regress/tests/base-job-test new file mode 100755 index 0000000000..15d4100b40 --- /dev/null +++ b/regress/tests/base-job-test @@ -0,0 +1,151 @@ +#!/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 <${cwd}/tmp/bconcmds +@output /dev/null +messages +label volume=TestVolume001 storage=File pool=Default +messages +END_OF_DATA + +run_bacula + +cat <${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 <${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 <${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