[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bacula-commits
Subject:    [Bacula-commits] git: Bacula branch, Branch-5.1,
From:       "Kern Sibbald" <kerns () users ! sourceforge ! net>
Date:       2011-02-22 17:34:58
Message-ID: E1Prw8l-0003b1-9U () sfs-ml-1 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Bacula".

The branch, Branch-5.1 has been updated
       via  214d6945061429f90dafd358e8a9a6e0946f29fa (commit)
       via  cbb2bdf7babe64f58f4b0a1f116e3452b47997f9 (commit)
       via  58754f931be37814b0b42f1e5c140d629df0a8eb (commit)
       via  852c63e68340b8cd47d0219559637608fc3ae187 (commit)
       via  debecea653e4c91009cde22cea389faed6c8236b (commit)
       via  2dc4f5b608fc3061aa4bf05765ff0667343da0cb (commit)
       via  990c15689bc7d89807cb92ab6ad4ed83482aff32 (commit)
       via  795be9118f01ac3651c63d0c0d4bd81f8f1a4358 (commit)
       via  e671e0fc5b20ced02a963704aa3eb1a7073e3485 (commit)
       via  379caf2a6e5af34f8494fa6dacf1e59b86a4788d (commit)
       via  9389781ddf491ad431dfad09d606b72ba2a50d62 (commit)
      from  1b065b792c2a84b916bcadb0b658b1fa39aa387d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 214d6945061429f90dafd358e8a9a6e0946f29fa
Author: Kern Sibbald <kern@sibbald.com>
Date:   Tue Feb 22 17:47:20 2011 +0100

    Tweak accurate_finish

commit cbb2bdf7babe64f58f4b0a1f116e3452b47997f9
Author: Kern Sibbald <kern@sibbald.com>
Date:   Tue Feb 22 12:39:53 2011 +0100

    Tweak Incomplete jobs in accurate_finish

commit 58754f931be37814b0b42f1e5c140d629df0a8eb
Author: Kern Sibbald <kern@sibbald.com>
Date:   Mon Feb 21 19:12:33 2011 +0100

    Add more debug to restart regress scripts

commit 852c63e68340b8cd47d0219559637608fc3ae187
Author: Eric Bollengier <eric@eb.homelinux.org>
Date:   Mon Feb 21 18:52:10 2011 +0100

    Add stack_trace() function to print current thread backtrace

commit debecea653e4c91009cde22cea389faed6c8236b
Author: Eric Bollengier <eric@eb.homelinux.org>
Date:   Mon Feb 21 18:51:39 2011 +0100

    Add HAVE_BACKTRACE in configure.in

commit 2dc4f5b608fc3061aa4bf05765ff0667343da0cb
Author: Kern Sibbald <kern@sibbald.com>
Date:   Mon Feb 21 18:28:42 2011 +0100

    Tweak restart incomplete jobs

commit 990c15689bc7d89807cb92ab6ad4ed83482aff32
Author: Eric Bollengier <eric@eb.homelinux.org>
Date:   Mon Feb 21 15:50:49 2011 +0100

    regress: tweak restart base job

commit 795be9118f01ac3651c63d0c0d4bd81f8f1a4358
Author: Eric Bollengier <eric@eb.homelinux.org>
Date:   Mon Feb 21 15:41:01 2011 +0100

    regress: fix add_attribute() function in perl lib

commit e671e0fc5b20ced02a963704aa3eb1a7073e3485
Author: Eric Bollengier <eric@eb.homelinux.org>
Date:   Mon Feb 21 15:14:54 2011 +0100

    regress: tweak restart base job

commit 379caf2a6e5af34f8494fa6dacf1e59b86a4788d
Author: Eric Bollengier <eric@eb.homelinux.org>
Date:   Mon Feb 21 13:37:44 2011 +0100

    regress: show problem in restart-accurate test

commit 9389781ddf491ad431dfad09d606b72ba2a50d62
Author: Eric Bollengier <eric@eb.homelinux.org>
Date:   Wed Feb 16 14:06:13 2011 +0100

    Add %h option in runscript to get client address

-----------------------------------------------------------------------

Summary of changes:
diff --git a/bacula/autoconf/config.h.in b/bacula/autoconf/config.h.in
index c84e7e8..c0fe5e9 100644
--- a/bacula/autoconf/config.h.in
+++ b/bacula/autoconf/config.h.in
@@ -1104,3 +1104,5 @@
 /* Define to the type of an unsigned integer type wide enough to hold a
    pointer, if such a type exists, and if the system does not define it. */
 #undef uintptr_t
+
+#undef HAVE_BACKTRACE
diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in
index 690b548..df417d3 100644
--- a/bacula/autoconf/configure.in
+++ b/bacula/autoconf/configure.in
@@ -2104,6 +2104,10 @@ AC_MSG_RESULT($fstype)

 AC_CHECK_HEADER(sys/statvfs.h, [ AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Defines if your \
system have the sys/statvfs.h header file])] , )

+AC_LANG_PUSH(C++)
+AC_CHECK_HEADERS([cxxabi.h execinfo.h], [ AC_DEFINE(HAVE_BACKTRACE,1,[Defines if \
your system have the cxxabi.h and execinfo.h header files for backtrace()])] , ) \
+AC_LANG_POP(C++) +
 dnl --------------------------------------------------------------------------
 dnl CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
 dnl --------------------------------------------------------------------------
diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c
index 5dd8809..b1b5d7a 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/dird/dird_conf.c b/bacula/src/dird/dird_conf.c
index 96479d0..46027bd 100644
--- a/bacula/src/dird/dird_conf.c
+++ b/bacula/src/dird/dird_conf.c
@@ -2061,11 +2061,13 @@ static void store_runscript(LEX *lc, RES_ITEM *item, int \
index, int pass)  /* callback function for edit_job_codes */
 extern "C" char *job_code_callback_filesetname(JCR *jcr, const char* param)
 {
-   if (param[0] == 'f') {
+   if (param[0] == 'f' && jcr->fileset) {
       return jcr->fileset->name();
-   } else {
-      return NULL;
-   }
+
+   } else if (param[0] == 'h' && jcr->client) {
+      return jcr->client->address;
+   }
+   return NULL;
 }

 bool parse_dir_config(CONFIG *config, const char *configfile, int exit_code)
diff --git a/bacula/src/filed/accurate.c b/bacula/src/filed/accurate.c
index 3f917e6..57317bd 100644
--- a/bacula/src/filed/accurate.c
+++ b/bacula/src/filed/accurate.c
@@ -1,7 +1,7 @@
 /*
    Bacula ® - The Network Backup Solution

-   Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2011 Free Software Foundation Europe e.V.

    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -182,17 +182,22 @@ void accurate_free(JCR *jcr)
 /* Send the deleted or the base file list and cleanup  */
 bool accurate_finish(JCR *jcr)
 {
-   bool ret=true;
+   bool ret = true;
+
+   if (jcr->is_canceled() || jcr->is_incomplete()) {
+      accurate_free(jcr);
+      return ret;
+   }
    if (jcr->accurate) {
-      if (!jcr->incomplete) {
-         if (jcr->is_JobLevel(L_FULL)) {
+      if (jcr->is_JobLevel(L_FULL)) {
+         if (!jcr->incomplete) {
             ret = accurate_send_base_file_list(jcr);
-         } else if (!jcr->incomplete) {
-            ret = accurate_send_deleted_list(jcr);
          }
+      } else {
+         ret = accurate_send_deleted_list(jcr);
       }
       accurate_free(jcr);
-      if (!jcr->incomplete && jcr->is_JobLevel(L_FULL)) {
+      if (jcr->is_JobLevel(L_FULL)) {
          Jmsg(jcr, M_INFO, 0, _("Space saved with Base jobs: %lld MB\n"),
               jcr->base_size/(1024*1024));
       }
diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c
index e1366f8..7330fde 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)
     *    <file-index> <stream> <info>
     */
    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());
       }
diff --git a/bacula/src/lib/bsys.c b/bacula/src/lib/bsys.c
index 3bff1c5..60b4887 100644
--- a/bacula/src/lib/bsys.c
+++ b/bacula/src/lib/bsys.c
@@ -751,3 +751,61 @@ int Zinflate(char *in, int in_len, char *out, int &out_len)
    return 1;
 #endif
 }
+
+#if HAVE_BACKTRACE && HAVE_GCC
+#include <cxxabi.h>
+#include <execinfo.h>
+void stack_trace()
+{
+   const size_t max_depth = 100;
+   size_t stack_depth;
+   void *stack_addrs[max_depth];
+   char **stack_strings;
+
+   stack_depth = backtrace(stack_addrs, max_depth);
+   stack_strings = backtrace_symbols(stack_addrs, stack_depth);
+
+   for (size_t i = 3; i < stack_depth; i++) {
+      size_t sz = 200; // just a guess, template names will go much wider
+      char *function = (char *)malloc(sz);
+      char *begin = 0, *end = 0;
+      // find the parentheses and address offset surrounding the mangled name
+      for (char *j = stack_strings[i]; *j; ++j) {
+         if (*j == '(') {
+            begin = j;
+         }
+         else if (*j == '+') {
+            end = j;
+         }
+      }
+      if (begin && end) {
+         *begin++ = '\0';
+         *end = '\0';
+         // found our mangled name, now in [begin, end)
+
+         int status;
+         char *ret = abi::__cxa_demangle(begin, function, &sz, &status);
+         if (ret) {
+            // return value may be a realloc() of the input
+            function = ret;
+         }
+         else {
+            // demangling failed, just pretend it's a C function with no args
+            strncpy(function, begin, sz);
+            strncat(function, "()", sz);
+            function[sz-1] = '\0';
+         }
+         Pmsg2(000, "    %s:%s\n", stack_strings[i], function);
+      }
+      else
+      {
+         // didn't find the mangled name, just print the whole line
+         Pmsg1(000, "    %s\n", stack_strings[i]);
+      }
+      free(function);
+   }
+   free(stack_strings); // malloc()ed by backtrace_symbols
+}
+#else /* HAVE_BACKTRACE && HAVE_GCC */
+void stack_trace() {}
+#endif /* HAVE_BACKTRACE && HAVE_GCC */
diff --git a/bacula/src/lib/protos.h b/bacula/src/lib/protos.h
index 94f932b..69296e1 100644
--- a/bacula/src/lib/protos.h
+++ b/bacula/src/lib/protos.h
@@ -80,6 +80,7 @@ int       b_strerror(int errnum, char *buf, size_t bufsiz);
 char     *escape_filename(const char *file_path);
 int       Zdeflate(char *in, int in_len, char *out, int &out_len);
 int       Zinflate(char *in, int in_len, char *out, int &out_len);
+void      stack_trace();

 /* bnet.c */
 int32_t    bnet_recv             (BSOCK *bsock);
diff --git a/regress/scripts/functions.pm b/regress/scripts/functions.pm
index 9fb4416..46f0a69 100644
--- a/regress/scripts/functions.pm
+++ b/regress/scripts/functions.pm
@@ -388,7 +388,7 @@ sub add_attribute
             $done=0;
         }

-        if ($l =~ /\Q$attr\E/i) {
+        if ($l =~ /^\s*\Q$attr\E/i) {
             if (!$obj || $cur_obj eq $obj) {
                 if (!$name || $cur_name eq $name) {
                     $l =~ s/\Q$attr\E\s*=\s*.+/$attr = $value/ig;
@@ -397,7 +397,7 @@ sub add_attribute
             }
         }

-        if ($l =~ /Name\s*=\s*"?([\w\d\.-]+)"?/i) {
+        if ($l =~ /^\s*Name\s*=\s*"?([\w\d\.-]+)"?/i) {
             $cur_name = $1;
         }

diff --git a/regress/tests/restart-accurate-job-test \
b/regress/tests/restart-accurate-job-test index 5c4cf26..eff5f15 100755
--- a/regress/tests/restart-accurate-job-test
+++ b/regress/tests/restart-accurate-job-test
@@ -26,6 +26,9 @@ setdebug level=0 trace=0 hangup0 client
 run job=$JobName yes
 wait
 messages
+sql
+select * from JobMedia;
+
 quit
 END_OF_DATA

@@ -35,12 +38,16 @@ scripts/check_for_zombie_jobs storage=File

 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out /dev/null
+@$out ${cwd}/tmp/log1.out
 setdebug level=0 trace=0 hangupP client
 @exec "sh -c 'touch $cwd/build/po/*'"
 @exec "sh -c 'touch $cwd/build/src/dird/*'"
 run job=$JobName yes
 wait
 messages
+sql
+select * from JobMedia;
+
 @#
 @# now do a restore
 @#
@@ -49,6 +56,8 @@ restore where=$tmp/bacula-restores storage=File select all done
 yes
 wait
 messages
+@$out ${cwd}/tmp/log3.out
+list jobs
 quit
 END_OF_DATA

@@ -58,4 +67,20 @@ stop_bacula

 check_two_logs
 check_restore_diff
+
+nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
+nb_I=`awk -F '|' '/RestartJob.+I/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
+nb1=`ls $cwd/build/po/* $cwd/build/src/dird/* | wc -l`
+nb1=`expr $nb1 + 50`
+
+if [ "$nb_I" -eq "$nb_F" ]; then
+    print_debug "ERROR: Incremental saves too much files (nb Incr == nb Full)"
+    estat=1
+fi
+
+if [ "$nb_I" -ge "$nb1" ]; then
+    print_debug "ERROR: Incremental saves too much files (more than $nb1)"
+    estat=1
+fi
+
 end_test
diff --git a/regress/tests/restart-base-job-test \
b/regress/tests/restart-base-job-test index 3dce0d2..42d6a58 100755
--- a/regress/tests/restart-base-job-test
+++ b/regress/tests/restart-base-job-test
@@ -13,8 +13,8 @@ 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')" +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Base', '$JobName', \
'Job', '$JobName')" +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Accurate', \
'yes', 'Job', '$JobName')"  start_test

 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@@ -27,10 +27,16 @@ wait
 messages
 @exec "touch $cwd/build/po/fr.po"
 setdebug level=0 trace=0 hangup0 client
-@#setdebug level  dir
+setdebug level 0 trace=1 dir
 run job=$JobName yes
 wait
 messages
+sql
+select * from JobMedia;
+
+setdebug level=0 trace=0 dir
+@$out ${cwd}/tmp/log3.out
+list jobs
 quit
 END_OF_DATA

@@ -58,4 +64,21 @@ stop_bacula

 check_two_logs
 check_restore_diff
+
+nb_B=`awk -F '|' '/RestartJob.+ B.+ B/ { gsub(/,/, "");print $7}' $tmp/log3.out`
+nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $7}' $tmp/log3.out`
+
+if [ $nb_F -ne $nb_B ]; then
+    print_debug "ERROR: Base and Full should have the same number of files"
+    estat=1
+fi
+
+nb_B=`awk -F '|' '/RestartJob.+B.+B/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
+nb_F=`awk -F '|' '/RestartJob.+F/ { gsub(/,/, ""); print $8}' $tmp/log3.out`
+
+if [ $nb_F -gt 1000000 ]; then
+    print_debug "ERROR: Base job should backup only one file"
+    estat=2
+fi
+
 end_test
diff --git a/regress/tests/restart-job-test b/regress/tests/restart-job-test
index cd9b608..4c36734 100755
--- a/regress/tests/restart-job-test
+++ b/regress/tests/restart-job-test
@@ -24,6 +24,9 @@ label storage=File volume=TestVolume001
 run job=$JobName yes
 wait
 messages
+sql
+select * from JobMedia where JobId=1;
+
 quit
 END_OF_DATA

diff --git a/regress/tests/restart2-job-test b/regress/tests/restart2-job-test
index 8119028..12f5681 100755
--- a/regress/tests/restart2-job-test
+++ b/regress/tests/restart2-job-test
@@ -29,6 +29,9 @@ END_OF_DATA

 run_bacula

+# Note, the following stops and restarts the FD while it
+#  is running to simulate a crash, so it is normal if
+#  orphanned buffers are reported
 sleep 5
 $bin/bacula-ctl-fd stop
 sleep 5
@@ -39,6 +42,9 @@ cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out ${cwd}/tmp/log1.out
 wait
 messages
+sql
+select * from JobMedia where JobId=1;
+
 quit
 END_OF_DATA



hooks/post-receive
--
Bacula

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in
Real-Time with Splunk. Collect, index and harness all the fast moving IT data
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business
insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Bacula-commits mailing list
Bacula-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic