]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix #7451 About deleted files incorrectly kept in Virtual Full
authorEric Bollengier <eric@baculasystems.com>
Tue, 9 Mar 2021 12:08:02 +0000 (13:08 +0100)
committerEric Bollengier <eric@baculasystems.com>
Fri, 26 Mar 2021 13:57:58 +0000 (14:57 +0100)
bacula/src/dird/vbackup.c

index e0f69bc64a674007b844792a1d97a56df27f5f7c..e2f52170c50806e1d92e4f5555656f7a0e714a49 100644 (file)
@@ -590,8 +590,15 @@ static bool create_bootstrap_file(JCR *jcr, char *jobids)
       Jmsg0(jcr, M_FATAL, 0, "Can't get batch sql connexion");
       return false;
    }
-
-   if (!db_get_file_list(jcr, jcr->db_batch, jobids, DBL_USE_DELTA | DBL_ALL_FILES,
+   /* If the new Job is a Full, we don't need to keep deleted records,
+    * however, if it's an incremental/differential, we should not restore
+    * the files from the Full, so we keep the deleted records
+    */
+   int opt = DBL_USE_DELTA;
+   if (jcr->jr.JobLevel != 'F') {
+      opt |= DBL_ALL_FILES;
+   }
+   if (!db_get_file_list(jcr, jcr->db_batch, jobids, opt,
                          insert_bootstrap_handler, (void *)rx.bsr_list))
    {
       Jmsg(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db_batch));