projects
/
BackupPC.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dfc71d1
)
store inc_size in backups rounded to 2k cluster
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 27 Jan 2011 11:28:26 +0000
(11:28 +0000)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Thu, 27 Jan 2011 11:28:26 +0000
(11:28 +0000)
bin/BackupPC_ASA_PostArchive_Update
patch
|
blob
|
history
diff --git
a/bin/BackupPC_ASA_PostArchive_Update
b/bin/BackupPC_ASA_PostArchive_Update
index
aff3a0b
..
afccb62
100755
(executable)
--- a/
bin/BackupPC_ASA_PostArchive_Update
+++ b/
bin/BackupPC_ASA_PostArchive_Update
@@
-130,6
+130,14
@@
sub system_ok {
system(@_) == 0 || die "system @_:$!";
}
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) = @_;
sub check_archive {
my ($host,$num) = @_;
@@
-228,14
+236,14
@@
sub check_archive {
print " [parts: ",join(", ", @tar_parts),"]" if $debug;
print " [parts: ",join(", ", @tar_parts),"]" if $debug;
- my $same = 1;
my @tar_files;
my $backup_part;
print " reading" if $debug;
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) {
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;
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);
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";
@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;
@db_files = sort @db_files;
+ my $same = 1;
+
if ($#tar_files != $#db_files) {
$same = 0;
print " NUMBER";
if ($#tar_files != $#db_files) {
$same = 0;
print " NUMBER";