Bacula-users

Re: [Bacula-users] Accurate Job - Cannot find previous jobids

2011-05-18 05:16:43
Subject: Re: [Bacula-users] Accurate Job - Cannot find previous jobids
From: Graham Keeling <graham AT equiinet DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Wed, 18 May 2011 10:13:37 +0100
On Wed, May 18, 2011 at 10:47:05AM +0200, Christian Manal wrote:
> Hi list,
> 
> I have a problem regarding accurate backups. When I set 'Accurate = yes'
> for any given job in my setup, the next run fails with the following
> error(s):
> 
>    Fatal error: Cannot find previous jobids.
>    Fatal error: Network error with FD during Backup: ERR=Interrupted
> system call
> 
> The strange thing is, contrary to everything google came up with for
> these messages, that the catalog seems to be in order. At least I can
> build a filetree for the most recent backups of all my clients in both
> bconsole and bat and restore files without a problem.
> 
> Does anyone have an idea what could be going on here? My Bacula version
> is 5.0.3 with a Postgres 8.3 catalog on Solaris 10. Any pointers would
> be appreciated.

Bacula looks for the last full backup in the database. And it relies on 
timestamps to find it. So, I would look for your previous full and its
timestamps, and check that your clock is set later than those timestamps.
Though, if this were the case, I would expect your job to be upgraded to be
a full. So perhaps something more complicated is going on.

If times don't explain it, take a look at this bacula code from
src/cats/sql_get.c (function db_accurate_get_jobids()), which is getting
the jobids from the database. You should be able to construct very similar
queries and run them by hand to see what the database says.
Or add some debug to get the exact sql queries being used.

   /* First, find the last good Full backup for this job/client/fileset */
   Mmsg(query,
"CREATE TABLE btemp3%s AS "
 "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles "
   "FROM Job JOIN FileSet USING (FileSetId) "
  "WHERE ClientId = %s "
    "AND Level='F' AND JobStatus IN ('T','W') AND Type='B' "
    "AND StartTime<'%s' "
    "AND FileSet.FileSet=(SELECT FileSet FROM FileSet WHERE FileSetId = %s) "
  "ORDER BY Job.JobTDate DESC LIMIT 1",
        edit_uint64(jcr->JobId, jobid),
        edit_uint64(jr->ClientId, clientid),
        date,
        edit_uint64(jr->FileSetId, filesetid));

   if (jr->JobLevel == L_INCREMENTAL || jr->JobLevel == L_VIRTUAL_FULL) {
      /* Now, find the last differential backup after the last full */
      Mmsg(query,
"INSERT INTO btemp3%s (JobId, StartTime, EndTime, JobTDate, PurgedFiles) "
 "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles "
   "FROM Job JOIN FileSet USING (FileSetId) "
  "WHERE ClientId = %s "
    "AND Level='D' AND JobStatus IN ('T','W') AND Type='B' "
    "AND StartTime > (SELECT EndTime FROM btemp3%s ORDER BY EndTime DESC LIMIT 
1) "
    "AND StartTime < '%s' "
    "AND FileSet.FileSet= (SELECT FileSet FROM FileSet WHERE FileSetId = %s) "
  "ORDER BY Job.JobTDate DESC LIMIT 1 ",
           jobid,
           clientid,
           jobid,
           date,
           filesetid);

      /* We just have to take all incremental after the last Full/Diff */
      Mmsg(query,
"INSERT INTO btemp3%s (JobId, StartTime, EndTime, JobTDate, PurgedFiles) "
 "SELECT JobId, StartTime, EndTime, JobTDate, PurgedFiles "
   "FROM Job JOIN FileSet USING (FileSetId) "
  "WHERE ClientId = %s "
    "AND Level='I' AND JobStatus IN ('T','W') AND Type='B' "
    "AND StartTime > (SELECT EndTime FROM btemp3%s ORDER BY EndTime DESC LIMIT 
1) "
    "AND StartTime < '%s' "
    "AND FileSet.FileSet= (SELECT FileSet FROM FileSet WHERE FileSetId = %s) "
  "ORDER BY Job.JobTDate DESC ",
           jobid,
           clientid,
           jobid,
           date,
           filesetid);


> Regards,
> Christian Manal
> 
> ------------------------------------------------------------------------------
> What Every C/C++ and Fortran developer Should Know!
> Read this article and learn how Intel has extended the reach of its 
> next-generation tools to help Windows* and Linux* C/C++ and Fortran 
> developers boost performance applications - including clusters. 
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> Bacula-users mailing list
> Bacula-users AT lists.sourceforge DOT net
> https://lists.sourceforge.net/lists/listinfo/bacula-users


------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users