From: Eric Bollengier Date: Thu, 12 May 2022 08:39:33 +0000 (+0200) Subject: Do not reassign catalog objects after a migration X-Git-Tag: Beta-15.0.0~577 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b86cfc52fb2d0160eaf5392603b7ce99f1035f1d;p=thirdparty%2Fbacula.git Do not reassign catalog objects after a migration The migration/copy process will re-recreate the catalog objects when we see them on the Media. --- diff --git a/bacula/src/dird/mac.c b/bacula/src/dird/mac.c index 932cb75d7..271115f71 100644 --- a/bacula/src/dird/mac.c +++ b/bacula/src/dird/mac.c @@ -831,15 +831,9 @@ void mac_cleanup(JCR *jcr, int TermCode, int writeTermCode) new_jobid, old_jobid); db_sql_query(wjcr->db, query.c_str(), NULL, NULL); - /* Move RestoreObjects */ - Mmsg(query, "UPDATE RestoreObject SET JobId=%s WHERE JobId=%s", - new_jobid, old_jobid); - db_sql_query(wjcr->db, query.c_str(), NULL, NULL); - - /* Move PluginObjects */ - Mmsg(query, "UPDATE Object SET JobId=%s WHERE JobId=%s", - new_jobid, old_jobid); - db_sql_query(wjcr->db, query.c_str(), NULL, NULL); + /* We do not need to move RestoreObject, Object or Metadata because + * they are recreated during the migration process + */ if (jcr->job->PurgeMigrateJob) { /* Purge old Job record */ @@ -870,6 +864,10 @@ void mac_cleanup(JCR *jcr, int TermCode, int writeTermCode) db_sql_query(wjcr->db, query.c_str(), NULL, NULL); } + /* We do not need to move RestoreObject, Object or Metadata because + * they are recreated during the copy process + */ + if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) { Jmsg(jcr, M_WARNING, 0, _("Error getting Job record for Job report: ERR=%s"), db_strerror(jcr->db));