Good day,
If a job spans multiple volumes, it will be inserted into the list of
candidates multiple times. Proposed fix attached.
--
Sergey Svishchev
$NetBSD$
--- src/dird/migrate.c.orig 2007-06-07 18:46:43.000000000 +0400
+++ src/dird/migrate.c
@@ -703,6 +703,7 @@ static int get_job_to_migrate(JCR *jcr)
}
Dmsg2(dbglevel, "Pool Occupancy ids=%d MediaIds=%s\n", ids.count,
ids.list);
+#if 0
/*
* Now loop over MediaIds getting more JobIds to migrate until
* we reduce the pool occupancy below the low water mark.
@@ -751,6 +752,48 @@ static int get_job_to_migrate(JCR *jcr)
}
}
+#else
+ if (!find_jobids_from_mediaid_list(jcr, &ids, "Volumes")) {
+ goto bail_out;
+ }
+ /* ids == list of jobs, MediaId == actually a JobId then */
+ p = ids.list;
+ for (int i=0; i < (int)ids.count; i++) {
+ stat = get_next_dbid_from_list(&p, &MediaId);
+ Dmsg2(dbglevel, "get_next_dbid stat=%d JobId=%u\n", stat, MediaId);
+ if (stat < 0) {
+ Jmsg(jcr, M_FATAL, 0, _("Invalid JobId found.\n"));
+ goto bail_out;
+ } else if (stat == 0) {
+ break;
+ }
+
+ mid.count = 1;
+ Mmsg(mid.list, "%s", edit_int64(MediaId, ed1));
+ if (jids.count > 0) {
+ pm_strcat(jids.list, ",");
+ }
+ pm_strcat(jids.list, mid.list);
+ jids.count += mid.count;
+
+ /* Find count of bytes from Jobs */
+ Mmsg(query, sql_job_bytes, mid.list);
+ Dmsg1(dbglevel, "Jobbytes query: %s\n", query.c_str());
+ if (!db_sql_query(jcr->db, query.c_str(), db_int64_handler, (void
*)&ctx)) {
+ Jmsg(jcr, M_FATAL, 0, _("SQL failed. ERR=%s\n"),
db_strerror(jcr->db));
+ goto bail_out;
+ }
+ pool_bytes -= ctx.value;
+ Dmsg1(dbglevel, "Total migrate Job bytes=%s\n",
edit_int64(ctx.value, ed1));
+ Dmsg2(dbglevel, "lowbytes=%s poolafter=%s\n",
+ edit_int64(jcr->rpool->MigrationLowBytes, ed1),
+ edit_int64(pool_bytes, ed2));
+ if (pool_bytes <= jcr->rpool->MigrationLowBytes) {
+ Dmsg0(dbglevel, "We should be done.\n");
+ break;
+ }
+ }
+#endif
/* Transfer jids to ids, where the jobs list is expected */
ids.count = jids.count;
pm_strcpy(ids.list, jids.list);
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel