summaryrefslogtreecommitdiffstats
path: root/lib/App/BorgRestore
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2020-09-27 16:16:44 +0200
committerFlorian Pritz <bluewind@xinu.at>2020-09-27 16:21:47 +0200
commit2bcc52b2e0b2397bd62dbba4db29b4fadc3870af (patch)
treeb384a1823fb6ebd83bd17c669a0325b99e136ec0 /lib/App/BorgRestore
parent660271c699a8c2a8d4051172f13bc3fbb520b88a (diff)
downloadApp-BorgRestore-2bcc52b2e0b2397bd62dbba4db29b4fadc3870af.tar.gz
App-BorgRestore-2bcc52b2e0b2397bd62dbba4db29b4fadc3870af.tar.xz
DB: Add assertion to check for missing files in databasedev
This is related to 62f5bc3ce90fedb396d103caae68dc2f211f1b16 and would trigger if the optimization prevents a path from being added to the database. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App/BorgRestore')
-rw-r--r--lib/App/BorgRestore/PathTimeTable/DB.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/App/BorgRestore/PathTimeTable/DB.pm b/lib/App/BorgRestore/PathTimeTable/DB.pm
index 069d991..685c7b9 100644
--- a/lib/App/BorgRestore/PathTimeTable/DB.pm
+++ b/lib/App/BorgRestore/PathTimeTable/DB.pm
@@ -1,6 +1,7 @@
package App::BorgRestore::PathTimeTable::DB;
use strictures 2;
+use Carp::Assert;
use Function::Parameters;
BEGIN {
use Log::Any qw($log);
@@ -130,6 +131,11 @@ method save_nodes() {
for my $key (keys %{$self->{stats}}) {
$log->debugf("Performance counter %s = %s", $key, $self->{stats}->{$key});
}
+
+ # +2 because:
+ # - borg list gives us `.` as the first path and we essentially skip it
+ # - we call `add_path` with `.` at the beginning of this method
+ assert($self->{stats}->{real_calls_to_db_class} + 2 == $self->{stats}->{total_paths}, "All files were actually added to the database");
}
1;