From: Kern Sibbald Date: Wed, 8 Oct 2008 16:42:05 +0000 (+0000) Subject: Fix migration SQL not to migrate a job that has not terminated. X-Git-Tag: Release-3.0.0~849 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a6a68e6c040431d768b4779ab81e79a83d2dbd9b;p=bacula%2Fbacula Fix migration SQL not to migrate a job that has not terminated. This is a partial fix to bug #1164. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7735 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index 68763e7087..4f3653aaf1 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -557,7 +557,7 @@ const char *sql_oldest_vol = const char *sql_jobids_from_mediaid = "SELECT DISTINCT Job.JobId,Job.StartTime FROM JobMedia,Job" " WHERE JobMedia.JobId=Job.JobId AND JobMedia.MediaId IN (%s)" - " AND Job.Type='B'" + " AND Job.Type='B' AND Job.JobStatus = 'T'" " ORDER by Job.StartTime"; /* Get the number of bytes in the pool */ @@ -566,7 +566,7 @@ const char *sql_pool_bytes = " (SELECT DISTINCT Job.JobId from Pool,Job,Media,JobMedia WHERE" " Pool.Name='%s' AND Media.PoolId=Pool.PoolId AND" " VolStatus in ('Full','Used','Error','Append') AND Media.Enabled=1 AND" - " Job.Type='B' AND" + " Job.Type='B' AND Job.JobStatus = 'T' AND" " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId)"; #ifdef xxx @@ -591,7 +591,7 @@ const char *sql_pool_time = "SELECT DISTINCT Job.JobId FROM Pool,Job,Media,JobMedia WHERE" " Pool.Name='%s' AND Media.PoolId=Pool.PoolId AND" " VolStatus in ('Full','Used','Error') AND Media.Enabled=1 AND" - " Job.Type='B' AND" + " Job.Type='B' AND Job.JobStatus = 'T' AND" " JobMedia.JobId=Job.JobId AND Job.PoolId=Media.PoolId" " AND Job.RealEndTime<='%s'"; diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index d92ca5215e..342e1df5e9 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -18,6 +18,8 @@ remove reader/writer in FOPTS???? General: 08Oct08 +kes Fix migration SQL not to migrate a job that has not terminated. + This is a partial fix to bug #1164. kes Sort JobIds returned from db_accurate_get_jobids() to fix Virtual backup start time bug reported by Graham Keeling. 08Oct08