On 7/3/26 10:38, Andrea Venturoli wrote:
Job {
   Name=CloudBackupFoo
   Schedule=Weekly
   JobDefs="DefaultJob"
   FileSet=Foo
   Type=Copy
   Selection Type=SQLQuery
   Selection Pattern="SELECT jobid FROM job WHERE name='BackupFoo' AND (level='F' OR 
level='D') AND jobstatus='T' AND poolid!=14 AND poolid!=15 ORDER BY endtime DESC LIMIT 
1"
   Full Backup Pool=Full
   Differential Backup Pool=Diff
}

This sort of works, but there are a few problems.

A) All copy jobs end up in the "CloudFull" pool; no matter if they were
a copy of a full or diff job; "CloudDiff" is never used.
This will prevent keeping fulls for, say, 4 months, and diffs for a
shorter time, thus wasting cloud space.

Because your query does not distinguish between Full and Differential jobs. If you want to store them separately, you need to select them separately.
B) If host "foo" does a full, the full gets copied; but if it skips the
next diff, the full will be copied twice, thus, again, wasting space for
nothing.

Because you didn't tell it not to. You told it to use the most recent job, whatever it is.


This is my SQL selection query for copy jobs:

  Selection Pattern = "SELECT DISTINCT J.JobId
                       FROM Job J
                       JOIN Pool P ON P.PoolId = J.PoolId
                       LEFT JOIN Job J2 ON J2.PriorJobId = J.JobId
                       WHERE P.Name = 'Full-Disk'
                       AND J2.JobId IS NULL
                       AND J.Type = 'B'
                       AND J.JobStatus IN ('T','W')
                       AND J.JobBytes > 0
                       AND J.StartTime > now() - interval 7 day"

Notice that it selects copies only within a specified time window, and only jobs that have not already been copied. (That's what the J2 join is for: "No later Job points at this Job as its prior.") It also selects only one Job type at a time (though I do it by Pool), where yours mixes Full and Differential together.



--
  Phil Stracchino
  Fenian House Publishing
  [email protected]
  [email protected]
  Landline: +1.603.293.8485
  Mobile:   +1.603.998.6958


_______________________________________________
Bacula-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to