]> git.sur5r.net Git - bacula/bacula/commitdiff
tweak debug
authorEric Bollengier <eric@eb.homelinux.org>
Wed, 29 Jul 2009 21:47:02 +0000 (23:47 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 3 Aug 2009 14:39:18 +0000 (16:39 +0200)
bacula/src/cats/sql_get.c
bacula/src/dird/ua_restore.c
bacula/src/dird/ua_tree.c
bacula/src/filed/accurate.c
regress/tests/base-job-test [new file with mode: 0755]

index 60db400f457da0c2c434befdd7b868366a341812..046ce89909cc4277f16aeb4899eb4b116c96240f 100644 (file)
@@ -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:
index 366d9ed3705994c31c21b508061a432cccda8957..0511fe3c6f3779771528a593ee4303f30536e16e 100644 (file)
@@ -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 */
index d5580ce3135dc76907f46ad872be130d9d0a9e85..9ac01a0dc75f3333818523e86240229a0abeb4bf 100644 (file)
@@ -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
index 91bc2a4965ca8f67a89566f1a154b6e0b6044728..92670a5e82adaeb5755597965638b4860404cbc4 100644 (file)
@@ -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 (executable)
index 0000000..15d4100
--- /dev/null
@@ -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 <<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