]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix handling of plugin/restore objects in copy/migration jobs
authorMichal Rakowski <michal.rakowski@baculasystems.com>
Thu, 1 Apr 2021 13:41:13 +0000 (15:41 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:01 +0000 (09:03 +0100)
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

index d6983450f631853809fc08ed99072e58a8227eae..1d4657a2b758ab39dd902df8ec03d9bae91640b5 100644 (file)
@@ -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)) {