Hello,

The current (5.2.13) implementation of PoolUncopiedJobs doesn't
allow to to make two copies of one job into different pools.

We have configured two Pools on Tape storage,  one long-term
(retention time 2 years) and one pool which is recycled every
two weeks. The short-term pool is intended for disaster recovery
and kept offsite for one week.

So we copy each job from disk storage to two different pools
on tape storage.  This cannot work when SelectionType=PoolUncopiedJobs
is used because the SQL does not care about the destination write pool.

Therefore we use SelectionType=SQLQuery and two different Selection
Patterns. Below you can see one of them which is used in our
CopyDiskToTape job.  The date restriction selections only jobs after
last Sundays 12:00,  you can ignore this because it is special for our
setup.

  Selection Type = SQLQuery
  Selection Pattern = "SELECT DISTINCT Job.JobId FROM Job,Pool WHERE
Pool.Name = 'DiskBackup' AND Pool.PoolId = Job.PoolId AND Job.Type = 'B'
AND Job.JobStatus IN ('T','W') AND Job.JobBytes > 0 AND Job.StartTime >
DATE_ADD(DATE_SUB(CURRENT_DATE(), INTERVAL
IF(DAYOFWEEK(NOW())=1,7,DAYOFWEEK(NOW())-1) DAY),INTERVAL 12 HOUR) AND
Job.JobId NOT IN (SELECT DISTINCT Job.PriorJobId FROM Job,Pool WHERE
Pool.Name = 'DiskCopy' AND Pool.PoolId = Job.PoolId AND PriorJobId != 0)
ORDER BY Job.StartTime"

I would suggest the following patch which modifies PoolUncopiedJobs
to select jobs if they have no copy in the destination(write) pool.

---
$ diff -ur bacula/src/dird/migrate.c.orig bacula/src/dird/migrate.c
--- bacula/src/dird/migrate.c.orig      2013-09-02 10:28:05.000000000 +0200
+++ bacula/src/dird/migrate.c   2014-01-07 13:47:42.685435585 +0100
@@ -626,9 +626,10 @@
    " AND Job.Type = 'B' AND Job.JobStatus IN ('T','W')"
    " AND Job.jobBytes > 0"
    " AND Job.JobId NOT IN"
-   " (SELECT PriorJobId FROM Job WHERE"
-   " Type IN ('B','C') AND Job.JobStatus IN ('T','W')"
-   " AND PriorJobId != 0)"
+   " (SELECT Job.PriorJobId FROM Job,Pool WHERE"
+   " Pool.Name = '%s' AND Pool.PoolId = Job.PoolId"
+   " AND Job.Type IN ('B','C') AND Job.JobStatus IN ('T','W')"
+   " AND Job.PriorJobId != 0)"
    " ORDER by Job.StartTime";
 
 /*
@@ -1016,8 +1017,8 @@
       goto bail_out;
    }
 
-   Dmsg1(dbglevel, "copy selection pattern=%s\n", jcr->rpool->name());
-   Mmsg(query, sql_jobids_of_pool_uncopied_jobs, jcr->rpool->name());
+   Dmsg2(dbglevel, "copy selection pattern=%s,%s\n", jcr->rpool->name(), 
jcr->pool->name());
+   Mmsg(query, sql_jobids_of_pool_uncopied_jobs, jcr->rpool->name(), 
jcr->pool->name());
    Dmsg1(dbglevel, "get uncopied jobs query=%s\n", query.c_str());
    if (!db_sql_query(jcr->db, query.c_str(), unique_dbid_handler, (void 
*)ids)) {
       Jmsg(jcr, M_FATAL, 0,
---

What do you think?

Best regards
Ulrich

-- 
Ulrich Leodolter <ulrich.leodol...@obvsg.at>
Oesterreichische Bibliothekenverbund und Service GmbH
Raimundgasse 1/3, A-1020 Wien
Fax +43 1 4035158-30
Tel +43 1 4035158-21
Web http://www.obvsg.at



------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to