From 62ee214eb948879f16a3b3c7f618e87b8209dc54 Mon Sep 17 00:00:00 2001 From: Alaa Eddine Elamri Date: Thu, 7 Apr 2022 16:51:47 +0200 Subject: [PATCH 1/5] cats: bvfs_update now looks for archive jobs too --- core/src/cats/bvfs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/cats/bvfs.cc b/core/src/cats/bvfs.cc index d6b1a5b5fe1..a0e26e7c393 100644 --- a/core/src/cats/bvfs.cc +++ b/core/src/cats/bvfs.cc @@ -277,7 +277,7 @@ void BareosDb::BvfsUpdateCache(JobControlRecord* jcr) Mmsg(cmd, "SELECT JobId from Job " "WHERE HasCache = 0 " - "AND Type IN ('B') AND JobStatus IN ('T', 'W', 'f', 'A') " + "AND Type IN ('B','A','a') AND JobStatus IN ('T', 'W', 'f', 'A') " "ORDER BY JobId"); SqlQuery(cmd, DbListHandler, &jobids_list); From 7d7dee5cc257bf2242073c959272dad2ed7675dc Mon Sep 17 00:00:00 2001 From: Alaa Eddine Elamri Date: Thu, 7 Apr 2022 18:03:21 +0200 Subject: [PATCH 2/5] systemtest: extended `ai-consolidate`to include `bvfs_update` check --- .../bareos-dir.d/job/virtualfull.conf.in | 17 ++++++++ .../bareos-dir.d/pool/AI-Consolidated.conf | 1 + .../bareos/bareos-dir.d/pool/AI-Longterm.conf | 11 ++++++ .../testrunner | 39 +++++++++++++++++-- 4 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 systemtests/tests/ai-consolidate-ignore-duplicate-job/etc/bareos/bareos-dir.d/job/virtualfull.conf.in create mode 100644 systemtests/tests/ai-consolidate-ignore-duplicate-job/etc/bareos/bareos-dir.d/pool/AI-Longterm.conf diff --git a/systemtests/tests/ai-consolidate-ignore-duplicate-job/etc/bareos/bareos-dir.d/job/virtualfull.conf.in b/systemtests/tests/ai-consolidate-ignore-duplicate-job/etc/bareos/bareos-dir.d/job/virtualfull.conf.in new file mode 100644 index 00000000000..8ad933c7651 --- /dev/null +++ b/systemtests/tests/ai-consolidate-ignore-duplicate-job/etc/bareos/bareos-dir.d/job/virtualfull.conf.in @@ -0,0 +1,17 @@ +Job { + Name = "VirtualLongtermFull" + Client = bareos-fd + FileSet = SelfTest + Type = Backup + Level = VirtualFull + Pool = AI-Consolidated + Messages = Standard + + Priority = 13 # run after Consolidate + Run Script { + console = "update jobid=%i jobtype=A" + Runs When = After + Runs On Client = No + Runs On Failure = No + } +} diff --git a/systemtests/tests/ai-consolidate-ignore-duplicate-job/etc/bareos/bareos-dir.d/pool/AI-Consolidated.conf b/systemtests/tests/ai-consolidate-ignore-duplicate-job/etc/bareos/bareos-dir.d/pool/AI-Consolidated.conf index 89b470ed5b1..f00e112738d 100644 --- a/systemtests/tests/ai-consolidate-ignore-duplicate-job/etc/bareos/bareos-dir.d/pool/AI-Consolidated.conf +++ b/systemtests/tests/ai-consolidate-ignore-duplicate-job/etc/bareos/bareos-dir.d/pool/AI-Consolidated.conf @@ -8,4 +8,5 @@ Pool { Label Format = "AI-Consolidated-" Volume Use Duration = 23h Storage = File + Next Pool = AI-Longterm } diff --git a/systemtests/tests/ai-consolidate-ignore-duplicate-job/etc/bareos/bareos-dir.d/pool/AI-Longterm.conf b/systemtests/tests/ai-consolidate-ignore-duplicate-job/etc/bareos/bareos-dir.d/pool/AI-Longterm.conf new file mode 100644 index 00000000000..e4e3f3e497e --- /dev/null +++ b/systemtests/tests/ai-consolidate-ignore-duplicate-job/etc/bareos/bareos-dir.d/pool/AI-Longterm.conf @@ -0,0 +1,11 @@ +Pool { + Name = AI-Longterm + Pool Type = Backup + Recycle = yes # Bareos can automatically recycle Volumes + Auto Prune = yes # Prune expired volumes + Volume Retention = 1 days # How long should jobs be kept? + Maximum Volume Bytes = 1G # Limit Volume size to something reasonable + Label Format = "AI-Longterm-" + Volume Use Duration = 23h + Storage = File +} diff --git a/systemtests/tests/ai-consolidate-ignore-duplicate-job/testrunner b/systemtests/tests/ai-consolidate-ignore-duplicate-job/testrunner index 64042d9ce56..dc40705f742 100755 --- a/systemtests/tests/ai-consolidate-ignore-duplicate-job/testrunner +++ b/systemtests/tests/ai-consolidate-ignore-duplicate-job/testrunner @@ -33,6 +33,8 @@ setup_data start_test +start_bareos + cat <$tmp/bconcmds @$out /dev/null messages @@ -51,7 +53,7 @@ run job=$JobName level=Incremental yes wait messages END_OF_DATA -run_bareos "$@" +run_bconsole cat <$tmp/bconcmds @$out $tmp/log1.out @@ -66,7 +68,7 @@ messages wait quit END_OF_DATA -run_bareos "$@" +run_bconsole # Consolidating zero-file incremental backups @@ -86,7 +88,7 @@ wait messages quit END_OF_DATA -run_bareos "$@" +run_bconsole # Consolidating a zero-file job in the middle of incremental backups @@ -116,7 +118,32 @@ END_OF_DATA run_bconsole -stop_bareos +cat <$tmp/bconcmds +@$out /dev/null +messages +wait +@$out $tmp/virtualfull.out +run job=VirtualLongtermFull yes +wait +@exec "sh -c 'touch ${tmp}/data/weird-files/file-13'" +run job=$JobName level=Incremental yes +wait +@exec "sh -c 'touch ${tmp}/data/weird-files/file-14'" +run job=$JobName level=Incremental yes +wait +@exec "sh -c 'touch ${tmp}/data/weird-files/file-15'" +run job=$JobName level=Incremental yes +wait +messages +.bvfs_lsdirs jobid=16 path= +.bvfs_update +.bvfs_lsdirs jobid=16 path= +wait +messages +quit +END_OF_DATA + +run_bconsole check_job_canceled @@ -136,4 +163,8 @@ expect_grep "purged JobIds 6,4,11 as they were consolidated into Job 15" \ "$tmp"/log3.out \ "consolidation of expected jobs did not happen." +expect_grep "0 0 A A A A A A A A A A A A A A /" \ + "$tmp"/virtualfull.out \ + "bvfs_update did not take into consideration VirtualFull Archive." + end_test From 6e4ad2f06322fedddab217e996d6760aa54cfad7 Mon Sep 17 00:00:00 2001 From: Alaa Eddine Elamri Date: Thu, 14 Apr 2022 14:21:20 +0200 Subject: [PATCH 3/5] cats: `bvfs_versions` now takes into consideration Archive jobs --- core/src/cats/bvfs.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/cats/bvfs.cc b/core/src/cats/bvfs.cc index a0e26e7c393..ae5ac0708e9 100644 --- a/core/src/cats/bvfs.cc +++ b/core/src/cats/bvfs.cc @@ -524,9 +524,9 @@ void Bvfs::GetAllFileVersions(DBId_t pathid, client); if (see_copies) { - Mmsg(filter, " AND Job.Type IN ('C', 'B') "); + Mmsg(filter, " AND Job.Type IN ('C', 'B', 'A', 'a') "); } else { - Mmsg(filter, " AND Job.Type = 'B' "); + Mmsg(filter, " AND Job.Type IN ('B', 'A', 'a') "); } db->EscapeString(jcr, fname_esc, fname, strlen(fname)); From 974663a0bdc32a279e948150bbead510a4066375 Mon Sep 17 00:00:00 2001 From: Alaa Eddine Elamri Date: Thu, 14 Apr 2022 16:14:24 +0200 Subject: [PATCH 4/5] systemtest: extended `ai-consolidate`to include `.bvfs_versions` check --- .../tests/ai-consolidate-ignore-duplicate-job/testrunner | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/systemtests/tests/ai-consolidate-ignore-duplicate-job/testrunner b/systemtests/tests/ai-consolidate-ignore-duplicate-job/testrunner index dc40705f742..e85ec437010 100755 --- a/systemtests/tests/ai-consolidate-ignore-duplicate-job/testrunner +++ b/systemtests/tests/ai-consolidate-ignore-duplicate-job/testrunner @@ -138,6 +138,7 @@ messages .bvfs_lsdirs jobid=16 path= .bvfs_update .bvfs_lsdirs jobid=16 path= +.bvfs_versions jobid=16 path=${tmp}/data/weird-files/ client=bareos-fd fname=normalfile wait messages quit @@ -167,4 +168,8 @@ expect_grep "0 0 A A A A A A A A A A A A A A /" \ "$tmp"/virtualfull.out \ "bvfs_update did not take into consideration VirtualFull Archive." +expect_grep "43xzp14Dk2Gvm+cKgszDNQ AI-Longterm" \ + "$tmp"/virtualfull.out \ + ".bvfs_versions did not find a file backup up by a VirtualFull Archive." + end_test From f8dd07bbd80800c6db2fca21a1e9b5697625fd19 Mon Sep 17 00:00:00 2001 From: Alaa Eddine Elamri Date: Thu, 14 Apr 2022 14:21:45 +0200 Subject: [PATCH 5/5] Updated CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d29d82acc82..0874f608d1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https: - webui: get volume and pool params from query instead of route [PR #1139] - FreeBSD packages: add missing ddl/update 2171_2192 and 2192_2210 files [PR #1147] - Fix director connects to client while `Connection From Director To Client` is disabled. [PR #1099] +- cats: make `.bvfs_update` and `.bvfs_versions` take archive jobs into consideration [PR #1152] ### Changed - contrib: rename Python modules to satisfy PEP8 [PR #768]