From: Eric Bollengier Date: Fri, 23 Apr 2021 07:02:43 +0000 (+0200) Subject: Fix incorrect backport for patch #7451 about deleted files in virtualfull X-Git-Tag: Release-11.3.2~566 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6682962946c0e47797dfec299148153c2133bf8d;p=thirdparty%2Fbacula.git Fix incorrect backport for patch #7451 about deleted files in virtualfull --- diff --git a/bacula/src/dird/vbackup.c b/bacula/src/dird/vbackup.c index 9e7d192e3..48d22fa3c 100644 --- a/bacula/src/dird/vbackup.c +++ b/bacula/src/dird/vbackup.c @@ -592,8 +592,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, + /* 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)); diff --git a/regress/tests/virtual-deleted-files-test b/regress/tests/virtual-deleted-files-test index f7ce901b8..82c072ba4 100755 --- a/regress/tests/virtual-deleted-files-test +++ b/regress/tests/virtual-deleted-files-test @@ -71,6 +71,6 @@ check_for_zombie_jobs storage=File stop_bacula check_two_logs -check_restore_diff +$rscripts/diff.pl -s $cwd/build -d $tmp/bacula-restores3/$cwd/build end_test