+my $host_nums;
+
+foreach my $host ( keys %$Hosts ) {
+ $host = lc $host;
+ my @backups = $bpc->BackupInfoRead($host);
+ if ( !@backups ) {
+ warn "$0: host $host doesn't have any backups... skipping\n";
+ next;
+ }
+
+ my $all_backup_numbers;
+ $all_backup_numbers->{ $_->{num} }++ foreach @backups;
+
+ $sth->execute( $host );
+ while ( my $row = $sth->fetchrow_hashref ) {
+ warn "# row ",dump($row) if $debug;
+ $all_backup_numbers->{ $row->{num} } =
+ $row->{inc_deleted} ? 0 :
+ $row->{size} == 0 ? 0 :
+ $row->{inc_size} > 0 ? 0 :
+ $row->{size} > 0 ? 1 :
+ 0;
+ }
+
+ warn "# $host all_backup_numbers = ",dump($all_backup_numbers),"\n";
+
+ $host_nums->{$host} = [
+ sort
+ grep { $all_backup_numbers->{$_} }
+ keys %$all_backup_numbers
+ ];
+}
+