From: Dobrica Pavlinusic Date: Thu, 27 Jan 2011 11:28:26 +0000 (+0000) Subject: store inc_size in backups rounded to 2k cluster X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=commitdiff_plain;h=5b0e5232f2207b308b77e9e1c9d01335563a6e31 store inc_size in backups rounded to 2k cluster --- diff --git a/bin/BackupPC_ASA_PostArchive_Update b/bin/BackupPC_ASA_PostArchive_Update index aff3a0b..afccb62 100755 --- a/bin/BackupPC_ASA_PostArchive_Update +++ b/bin/BackupPC_ASA_PostArchive_Update @@ -130,6 +130,14 @@ sub system_ok { system(@_) == 0 || die "system @_:$!"; } +my $sth_inc_size = $dbh->prepare(qq{ + update backups set + inc_size = ?, + parts = ?, + inc_deleted = false + where id = ? +}); + sub check_archive { my ($host,$num) = @_; @@ -228,14 +236,14 @@ sub check_archive { print " [parts: ",join(", ", @tar_parts),"]" if $debug; - my $same = 1; my @tar_files; my $backup_part; print " reading" if $debug; - my $part_nr = 1; + my $part_nr = 0; + my $inc_size = 0; foreach my $filename (@tar_parts) { @@ -302,14 +310,20 @@ sub check_archive { my $md5 = $md5sum->{$filename} || die "no md5sum for $filename in ",dump($md5sum); my $items = 1; + $part_nr++; check_part($host, $num, $part_nr, $tar_size, $size, $md5, $items); - $part_nr++; + # round increment size to 2k block size + $inc_size += int(($size + 2048) / 2048); } - # short-cut and exit; - return $same unless($same); + $sth_inc_size->execute( + $inc_size, + $part_nr, + get_backup_id($host, $num), + ); + $dbh->commit; @tar_files = sort @tar_files; print "\n\t",($#tar_files + 1), " tar files"; @@ -335,6 +349,8 @@ sub check_archive { @db_files = sort @db_files; + my $same = 1; + if ($#tar_files != $#db_files) { $same = 0; print " NUMBER";