From b86cfc52fb2d0160eaf5392603b7ce99f1035f1d Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Thu, 12 May 2022 10:39:33 +0200 Subject: [PATCH] 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. --- bacula/src/dird/mac.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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)); -- 2.47.3