--- /dev/null
+
+ This patch should prevent migration jobs from attempting to migrate
+ jobs that failed. Apply it to Bacula 2.4.3 (possibly earlier versions)
+ with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.3-migrate.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+
+Index: src/dird/migrate.c
+===================================================================
+--- src/dird/migrate.c (revision 7757)
++++ src/dird/migrate.c (working copy)
+@@ -377,7 +377,7 @@
+ * to avoid two threads from using the BSOCK structure at
+ * the same time.
+ */
+- if (!bnet_fsend(sd, "run")) {
++ if (!sd->fsend("run")) {
+ return false;
+ }
+
+@@ -520,6 +520,7 @@
+ "SELECT DISTINCT Job.JobId,Job.StartTime FROM Job,Pool,Client"
+ " WHERE Client.Name='%s' AND Pool.Name='%s' AND Job.PoolId=Pool.PoolId"
+ " AND Job.ClientId=Client.ClientId AND Job.Type='B'"
++ " AND Job.JobStatus = 'T'"
+ " ORDER by Job.StartTime";
+
+ /* Get Volume names in Pool */
+@@ -533,9 +534,9 @@
+ "SELECT DISTINCT Job.JobId,Job.StartTime FROM Media,JobMedia,Job"
+ " WHERE Media.VolumeName='%s' AND Media.MediaId=JobMedia.MediaId"
+ " AND JobMedia.JobId=Job.JobId AND Job.Type='B'"
++ " AND Job.JobStatus = 'T' AND Media.Enabled=1"
+ " ORDER by Job.StartTime";
+
+-
+ const char *sql_smallest_vol =
+ "SELECT Media.MediaId FROM Media,Pool,JobMedia WHERE"
+ " Media.MediaId in (SELECT DISTINCT MediaId from JobMedia) AND"
+@@ -570,7 +571,6 @@
+ const char *sql_job_bytes =
+ "SELECT SUM(JobBytes) FROM Job WHERE JobId IN (%s)";
+
+-
+ /* Get Media Ids in Pool */
+ const char *sql_mediaids =
+ "SELECT MediaId FROM Media,Pool WHERE"
--- /dev/null
+
+ This patch should fix the bug reported on the bacula-users list where
+ a retention period of 100 years does immediate prunning.
+ Apply it to 2.4.3 (or earlier versions) with:
+
+ cd <bacula-source>
+ patch -p0 <2.4.3-prune.patch
+ ./configure <your-options>
+ make
+ ...
+ make install
+
+Index: src/dird/ua_prune.c
+===================================================================
+--- src/dird/ua_prune.c (revision 7757)
++++ src/dird/ua_prune.c (working copy)
+@@ -202,7 +202,7 @@
+ now = (utime_t)time(NULL);
+
+ /* Select Jobs -- for counting */
+- Mmsg(query, count_select_job, edit_uint64(now - period, ed1),
++ Mmsg(query, count_select_job, edit_int64(now - period, ed1),
+ edit_int64(cr.ClientId, ed2));
+ Dmsg3(050, "select now=%u period=%u sql=%s\n", (uint32_t)now,
+ (uint32_t)period, query.c_str());
+@@ -230,7 +230,7 @@
+ del.JobId = (JobId_t *)malloc(sizeof(JobId_t) * del.max_ids);
+
+ /* Now process same set but making a delete list */
+- Mmsg(query, select_job, edit_uint64(now - period, ed1),
++ Mmsg(query, select_job, edit_int64(now - period, ed1),
+ edit_int64(cr.ClientId, ed2));
+ db_sql_query(ua->db, query.c_str(), file_delete_handler, (void *)&del);
+
+@@ -318,7 +318,7 @@
+ * Select all files that are older than the JobRetention period
+ * and stuff them into the "DeletionCandidates" table.
+ */
+- edit_uint64(now - period, ed1);
++ edit_int64(now - period, ed1);
+ Mmsg(query, insert_delcand, (char)JobType, ed1,
+ edit_int64(cr.ClientId, ed2));
+ if (!db_sql_query(ua->db, query.c_str(), NULL, (void *)NULL)) {
+@@ -443,10 +443,10 @@
+ edit_int64(mr->MediaId, ed1);
+ period = mr->VolRetention;
+ now = (utime_t)time(NULL);
+- edit_uint64(now-period, ed2);
++ edit_int64(now-period, ed2);
+ Mmsg(query, sel_JobMedia, ed1, ed2);
+- Dmsg3(250, "Now=%d period=%d now-period=%d\n", (int)now, (int)period,
+- (int)(now-period));
++ Dmsg3(250, "Now=%d period=%d now-period=%s\n", (int)now, (int)period,
++ ed2);
+
+ Dmsg1(050, "Query=%s\n", query.c_str());
+ if (!db_sql_query(ua->db, query.c_str(), file_delete_handler, (void *)del)) {
* to avoid two threads from using the BSOCK structure at
* the same time.
*/
- if (!bnet_fsend(sd, "run")) {
+ if (!sd->fsend("run")) {
return false;
}
"SELECT DISTINCT Job.JobId,Job.StartTime FROM Job,Pool,Client"
" WHERE Client.Name='%s' AND Pool.Name='%s' AND Job.PoolId=Pool.PoolId"
" AND Job.ClientId=Client.ClientId AND Job.Type='B'"
+ " AND Job.JobStatus = 'T'"
" ORDER by Job.StartTime";
/* Get Volume names in Pool */
"SELECT DISTINCT Job.JobId,Job.StartTime FROM Media,JobMedia,Job"
" WHERE Media.VolumeName='%s' AND Media.MediaId=JobMedia.MediaId"
" AND JobMedia.JobId=Job.JobId AND Job.Type='B'"
+ " AND Job.JobStatus = 'T' AND Media.Enabled=1"
" ORDER by Job.StartTime";
-
const char *sql_smallest_vol =
"SELECT Media.MediaId FROM Media,Pool,JobMedia WHERE"
" Media.MediaId in (SELECT DISTINCT MediaId from JobMedia) AND"
const char *sql_job_bytes =
"SELECT SUM(JobBytes) FROM Job WHERE JobId IN (%s)";
-
/* Get Media Ids in Pool */
const char *sql_mediaids =
"SELECT MediaId FROM Media,Pool WHERE"
now = (utime_t)time(NULL);
/* Select Jobs -- for counting */
- Mmsg(query, count_select_job, edit_uint64(now - period, ed1),
+ Mmsg(query, count_select_job, edit_int64(now - period, ed1),
edit_int64(cr.ClientId, ed2));
Dmsg3(050, "select now=%u period=%u sql=%s\n", (uint32_t)now,
(uint32_t)period, query.c_str());
del.JobId = (JobId_t *)malloc(sizeof(JobId_t) * del.max_ids);
/* Now process same set but making a delete list */
- Mmsg(query, select_job, edit_uint64(now - period, ed1),
+ Mmsg(query, select_job, edit_int64(now - period, ed1),
edit_int64(cr.ClientId, ed2));
db_sql_query(ua->db, query.c_str(), file_delete_handler, (void *)&del);
* Select all files that are older than the JobRetention period
* and stuff them into the "DeletionCandidates" table.
*/
- edit_uint64(now - period, ed1);
+ edit_int64(now - period, ed1);
Mmsg(query, insert_delcand, (char)JobType, ed1,
edit_int64(cr.ClientId, ed2));
if (!db_sql_query(ua->db, query.c_str(), NULL, (void *)NULL)) {
edit_int64(mr->MediaId, ed1);
period = mr->VolRetention;
now = (utime_t)time(NULL);
- edit_uint64(now-period, ed2);
+ edit_int64(now-period, ed2);
Mmsg(query, sel_JobMedia, ed1, ed2);
- Dmsg3(250, "Now=%d period=%d now-period=%d\n", (int)now, (int)period,
- (int)(now-period));
+ Dmsg3(250, "Now=%d period=%d now-period=%s\n", (int)now, (int)period,
+ ed2);
Dmsg1(050, "Query=%s\n", query.c_str());
if (!db_sql_query(ua->db, query.c_str(), file_delete_handler, (void *)del)) {
#undef VERSION
#define VERSION "2.4.3"
-#define BDATE "10 October 2008"
-#define LSMDATE "10Oct08"
+#define BDATE "24 October 2008"
+#define LSMDATE "24Oct08"
#define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
#define BYEAR "2008" /* year for copyright messages in progs */
Technical notes on version 2.4
General:
+24Oct08
+kes Modify SQL so that jobs that failed will not be migrated.
+kes Correct bug where long retention periods caused immediate
+ prunning.
+
Release Version 2.4.3
27Oct08
ebl Apply 2.4.3-update-slots.patch to fix #1175. About update slots