From 1f2062b53714d2718d7eafdcb53a75dbad88ed84 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 7 Jan 2012 16:32:14 +0100 Subject: [PATCH] Limit migration/copy jobs to starting 100 at a time --- bacula/src/dird/migrate.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bacula/src/dird/migrate.c b/bacula/src/dird/migrate.c index f43d4ad3ba..e355e7c68a 100644 --- a/bacula/src/dird/migrate.c +++ b/bacula/src/dird/migrate.c @@ -668,6 +668,7 @@ static int getJob_to_migrate(JCR *jcr) struct tm tm; char dt[MAX_TIME_LENGTH]; int count = 0; + int limit = 99; /* limit + 1 is max jobs to start */ ids.list = get_pool_memory(PM_MESSAGE); ids.list[0] = 0; @@ -851,6 +852,10 @@ static int getJob_to_migrate(JCR *jcr) jcr->get_ActionName(1), ids.list); Dmsg2(dbglevel, "Before loop count=%d ids=%s\n", ids.count, ids.list); + /* + * Note: to not over load the system, limit the number + * of new jobs started to 100 (see limit above) + */ for (int i=1; i < (int)ids.count; i++) { JobId = 0; stat = get_next_jobid_from_list(&p, &JobId); @@ -863,8 +868,12 @@ static int getJob_to_migrate(JCR *jcr) goto ok_out; } jcr->MigrateJobId = JobId; - start_migration_job(jcr); - Dmsg0(dbglevel, "Back from start_migration_job\n"); + /* Don't start any more when limit reaches zero */ + limit--; + if (limit > 0) { + start_migration_job(jcr); + Dmsg0(dbglevel, "Back from start_migration_job\n"); + } } /* Now get the last JobId and handle it in the current job */ -- 2.39.5