From 07f24f1c48e97e817d3a13647dddb97e1ca71d7e Mon Sep 17 00:00:00 2001 From: Michal Rakowski Date: Thu, 1 Apr 2021 15:41:13 +0200 Subject: [PATCH] Fix handling of plugin/restore objects in copy/migration jobs Objects are being inserted during reading spool file from the SD (during the despool_attributes_from_file() call), so no need to insert those manually at the end of MAC job. --- bacula/src/dird/mac.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/bacula/src/dird/mac.c b/bacula/src/dird/mac.c index d6983450f..1d4657a2b 100644 --- a/bacula/src/dird/mac.c +++ b/bacula/src/dird/mac.c @@ -773,27 +773,6 @@ void mac_cleanup(JCR *jcr, int TermCode, int writeTermCode) Mmsg(query, "UPDATE Job SET Type='%c' WHERE JobId=%s", (char)JT_JOB_COPY, new_jobid); db_sql_query(wjcr->db, query.c_str(), NULL, NULL); - - /* Copy RestoreObjects */ - Mmsg(query, "INSERT INTO RestoreObject (ObjectName,PluginName,RestoreObject," - "ObjectLength,ObjectFullLength,ObjectIndex,ObjectType," - "ObjectCompression,FileIndex,JobId) " - "SELECT ObjectName,PluginName,RestoreObject," - "ObjectLength,ObjectFullLength,ObjectIndex,ObjectType," - "ObjectCompression,FileIndex,%s FROM RestoreObject WHERE JobId=%s", - new_jobid, old_jobid); - db_sql_query(wjcr->db, query.c_str(), NULL, NULL); - - /* Copy PluginObjects */ - Mmsg(query, "INSERT INTO Object (JobId, Path, Filename, PluginName, ObjectCategory," - "ObjectType, ObjectName, ObjectSource, ObjectUUID, ObjectSize) " - "SELECT %s, Path, Filename, PluginName, ObjectCategory," - "ObjectType, ObjectName, ObjectSource, ObjectUUID, ObjectSize FROM Object WHERE JobId=%s", - new_jobid, old_jobid); - if (!db_sql_query(wjcr->db, query.c_str(), NULL, NULL)) { - Jmsg(jcr, M_WARNING, 0, _("Error copying PluginObject for JobId=%ld: %s"), - old_jobid, db_strerror(jcr->db)); - } } if (!db_get_job_record(jcr, jcr->db, &jcr->jr)) { -- 2.47.3