[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bacula-devel] copy jobs


On Tuesday 23 December 2008 14:32:02 JanJaap Scholing wrote:
> Hi,
>
> It seems that the copy jobs PoolUncopiedJobs selection type is broken in
> the 2.5.26 version.
>
> Every time when the copy job runs it makes an copy of the same jobs...

Yes, you are right.  It is a result of recent, important changes we made to 
the way Copy works.  We need to update a few of the SQL statements to modify 
the way the search works.

>
> Before the copy job I run the following sql query (just for my
> information):
>
> SELECT DISTINCT Job.JobId,Job.StartTime FROM Job,Pool WHERE Pool.Name =
> 'Virt-Pool' AND Pool.PoolId = Job.PoolId AND Job.Type = 'B' AND
> Job.JobStatus = 'T' AND Job.JobId NOT IN (SELECT PriorJobId FROM Job WHERE
> Type = 'B' AND Job.JobStatus = 'T' AND PriorJobId != 0)  ORDER by
> Job.StartTime;
>
> result:
>
> +-------+---------------------+
>
> | JobId | StartTime           |
>
> +-------+---------------------+
>
> |   240 | 2008-12-22 14:30:09 |
> |   243 | 2008-12-22 17:27:54 |
> |   244 | 2008-12-22 23:11:38 |
> |   246 | 2008-12-23 01:05:02 |
> |   247 | 2008-12-23 01:11:57 |
> |   248 | 2008-12-23 01:20:59 |
> |   249 | 2008-12-23 01:22:21 |
> |   250 | 2008-12-23 01:35:06 |
> |   251 | 2008-12-23 02:05:02 |
> |   252 | 2008-12-23 02:05:15 |
> |   253 | 2008-12-23 02:35:21 |
> |   254 | 2008-12-23 02:44:33 |
> |   255 | 2008-12-23 03:05:02 |
> |   256 | 2008-12-23 03:06:35 |
> |   258 | 2008-12-23 05:05:02 |
> |   259 | 2008-12-23 06:05:02 |
> |   260 | 2008-12-23 06:10:28 |
> |   332 | 2008-12-23 11:13:57 |
>
> +-------+---------------------+
>
> Then I run the copy job
>
> After the copy job:
>
> SELECT DISTINCT Job.JobId,Job.StartTime FROM Job,Pool WHERE Pool.Name =
> 'Virt-Pool' AND Pool.PoolId = Job.PoolId AND Job.Type = 'B' AND
> Job.JobStatus = 'T' AND Job.JobId NOT IN (SELECT PriorJobId FROM Job
> WHERE Type = 'B' AND Job.JobStatus = 'T' AND PriorJobId != 0)  ORDER by
> Job.StartTime;

Yes, at this point, if I am not mistaken, the correct (new) way to check is:

> SELECT DISTINCT Job.JobId,Job.StartTime FROM Job,Pool WHERE Pool.Name =
> 'Virt-Pool' AND Pool.PoolId = Job.PoolId AND Job.Type = 'B' AND
> Job.JobStatus = 'T' AND Job.JobId NOT IN (SELECT PriorJobId FROM Job
> WHERE Type = 'C' AND Job.JobStatus = 'T' AND PriorJobId != 0)  ORDER by
> Job.StartTime;

Note, I changed a 'B' to 'C' in the second to last line.

I think the attached patch will probably solve your immediate problem.  
However, in thinking about this, I realize that there is a larger problem of 
how to deal with migrating the new Copy jobs.

Feedback on the patch would be appreciated.

Best regards,

Kern

>
>
>
> result:
>
>
>
> +-------+---------------------+
>
> | JobId | StartTime           |
>
> +-------+---------------------+
>
> |   240 | 2008-12-22 14:30:09 |
> |
> |   243 | 2008-12-22 17:27:54 |
> |
> |   244 | 2008-12-22 23:11:38 |
> |
> |   246 | 2008-12-23 01:05:02 |
> |
> |   247 | 2008-12-23 01:11:57 |
> |
> |   248 | 2008-12-23 01:20:59 |
> |
> |   249 | 2008-12-23 01:22:21 |
> |
> |   250 | 2008-12-23 01:35:06 |
> |
> |   251 | 2008-12-23 02:05:02 |
> |
> |   252 | 2008-12-23 02:05:15 |
> |
> |   253 | 2008-12-23 02:35:21 |
> |
> |   254 | 2008-12-23 02:44:33 |
> |
> |   255 | 2008-12-23 03:05:02 |
> |
> |   256 | 2008-12-23 03:06:35 |
> |
> |   258 | 2008-12-23 05:05:02 |
> |
> |   259 | 2008-12-23 06:05:02 |
> |
> |   260 | 2008-12-23 06:10:28 |
> |
> |   332 | 2008-12-23 11:13:57 |
>
> +-------+---------------------+
>
> The same jobs....
>
> When I run the copy job again, the same  jobs are copied to tape again..
>
> /etc/bacula/bacula-dir.conf:
>
>
> #
> # Default template for a CopyDiskToTape Job
> #
> JobDefs {
>   Name                          = CopyDiskToTape
>   Type                          = Copy
>   Messages                      = Standard
>   Client                        = None
>   FileSet                       = None
>   Selection Type                = PoolUncopiedJobs
>   Maximum Concurrent Jobs       = 10
>   SpoolData                     = No
>   Allow Duplicate Jobs          = Yes
>   Allow Higher Duplicates       = No
>   Cancel Queued Duplicates      = No
>   Cancel Running Duplicates     = No
>   Prefer Mounted Volumes        = No
>   Priority                      = 10
> }
>
> Schedule {
>   Name                          = DaySchedule11:00
>   Run                           = Level=Full daily at 11:00
> }
>
> Job {
>   Name                          = D2D2T
>   Enabled                       = Yes
>   Schedule                      = DaySchedule11:00
>   Pool                          = Virt-Pool
>   JobDefs                       = CopyDiskToTape
>   Prefer Mounted Volumes        = No
> }
>
> Regards
>
> JanJaap
>
>
>
>
>
> _________________________________________________________________
> De leukste online filmpjes vind je op MSN Video!
> http://video.msn.com/video.aspx?mkt=nl-nl
> ---------------------------------------------------------------------------
>--- _______________________________________________
> Bacula-devel mailing list
> Bacula-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/bacula-devel


Index: src/dird/migrate.c
===================================================================
--- src/dird/migrate.c	(revision 8235)
+++ src/dird/migrate.c	(working copy)
@@ -590,7 +590,7 @@
    " AND Job.Type = 'B' AND Job.JobStatus = 'T'"
    " AND Job.JobId NOT IN"
    " (SELECT PriorJobId FROM Job WHERE"
-   " Type = 'B' AND Job.JobStatus = 'T'"
+   " Type = 'C' AND Job.JobStatus = 'T'"
    " AND PriorJobId != 0)"
    " ORDER by Job.StartTime";
 
------------------------------------------------------------------------------
_______________________________________________
Bacula-devel mailing list
Bacula-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bacula-devel


This mailing list archive is a service of Copilotco.