/[BackupPC]/trunk/bin/BackupPC_tarIncCreate
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/BackupPC_tarIncCreate

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 236 by dpavlin, Thu Nov 10 15:38:14 2005 UTC revision 251 by dpavlin, Mon Dec 12 12:16:01 2005 UTC
# Line 161  my $sth_inc_size = $dbh->prepare(qq{ Line 161  my $sth_inc_size = $dbh->prepare(qq{
161                  inc_size = ?,                  inc_size = ?,
162                  parts = ?,                  parts = ?,
163                  inc_deleted = false                  inc_deleted = false
164          where id = ? });          where id = ?
165    });
166  my $sth_backup_parts = $dbh->prepare(qq{  my $sth_backup_parts = $dbh->prepare(qq{
167          insert into backup_parts (          insert into backup_parts (
168                  backup_id,                  backup_id,
# Line 204  die "problem with $tar_dir, check GzipTe Line 205  die "problem with $tar_dir, check GzipTe
205    
206  my $tar_file = BackupPC::SearchLib::getGzipName($Host, $ShareName, $Num) || die "can't getGzipName($Host, $ShareName, $Num)";  my $tar_file = BackupPC::SearchLib::getGzipName($Host, $ShareName, $Num) || die "can't getGzipName($Host, $ShareName, $Num)";
207    
208  my $tar_path = $tar_dir . '/' . $tar_file . '.tmp';  my $tar_path_final = $tar_dir . '/' . $tar_file;
209    my $tar_path = $tar_path_final . '.tmp';
210    
211  $tar_path =~ s#//#/#g;  $tar_path =~ s#//#/#g;
212    
213  my $sth = $dbh->prepare(qq{  my $sth = $dbh->prepare(qq{
# Line 233  sub new_tar_part { Line 236  sub new_tar_part {
236          if ($fh) {          if ($fh) {
237                  return if ($current_tar_size == 0);                  return if ($current_tar_size == 0);
238    
239                  print STDERR "# closing part $part\n" if ($opts{d});                  print STDERR " $part" if ($opts{v});
240    
241                  #                  #
242                  # Finish with two null 512 byte headers,                  # Finish with two null 512 byte headers,
# Line 264  sub new_tar_part { Line 267  sub new_tar_part {
267                  $total_increment_size += int( ( $size + 1023 ) / 1024 ) * 1024;                  $total_increment_size += int( ( $size + 1023 ) / 1024 ) * 1024;
268    
269                  if ($arg->{close}) {                  if ($arg->{close}) {
270                          print STDERR "# close last part\n" if ($opts{d});  
271                            if ($part == 1) {
272                                    print STDERR " single";
273                                    rename "${tar_path}/1.tar.gz", "${tar_path_final}/.tar.gz" || die "can't move tar ${tar_path}: $! ";
274                                    rename "${tar_path}/1.md5", "${tar_path_final}/.md5" || die "can't move md5 ${tar_path}: $! ";
275                            } else {
276                                    print STDERR " [last]";
277                                    rename "${tar_path}", "${tar_path_final}" || die "can't move tar ${tar_path}: $! ";
278                            }
279    
280                          $sth_inc_size->execute(                          $sth_inc_size->execute(
281                                  $total_increment_size,                                  $total_increment_size,
282                                  $part,                                  $part,
283                                  $backup_id                                  $backup_id
284                          );                          );
285    
286                            print STDERR ", $total_increment_size bytes\n" if ($opts{v});
287    
288                          return;                          return;
289                  }                  }
290    
# Line 557  sub TarWriteFileInfo Line 572  sub TarWriteFileInfo
572  sub seedCache($$$) {  sub seedCache($$$) {
573          my ($host, $share, $dumpNo) = @_;          my ($host, $share, $dumpNo) = @_;
574    
575          print STDERR curr_time(), "getting files for $host:$share increment $dumpNo..." if ($opts{v});          print STDERR curr_time(), "$host:$share #$dumpNo" if ($opts{v});
576          my $sql = q{          my $sql = q{
577                  SELECT path,size                  SELECT path,size
578                  FROM files                  FROM files
# Line 569  sub seedCache($$$) { Line 584  sub seedCache($$$) {
584          my $sth = $dbh->prepare($sql);            my $sth = $dbh->prepare($sql);  
585          $sth->execute($host, $share, $dumpNo);          $sth->execute($host, $share, $dumpNo);
586          my $count = $sth->rows;          my $count = $sth->rows;
587          print STDERR " found $count items\n" if ($opts{v});          print STDERR " $count items, parts:" if ($opts{v});
588          while (my $row = $sth->fetchrow_arrayref) {          while (my $row = $sth->fetchrow_arrayref) {
589  #print STDERR "+ ", $row->[0],"\n";  #print STDERR "+ ", $row->[0],"\n";
590                  $in_backup_increment->{ $row->[0] } = $row->[1];                  $in_backup_increment->{ $row->[0] } = $row->[1];
# Line 617  sub TarWriteFile Line 632  sub TarWriteFile
632      # is this file too large to fit into MaxArchiveFileSize?      # is this file too large to fit into MaxArchiveFileSize?
633    
634      if ( ($current_tar_size + tar_overhead($tarPath) + $size) > $max_file_size ) {      if ( ($current_tar_size + tar_overhead($tarPath) + $size) > $max_file_size ) {
635          print STDERR "# tar file $current_tar_size + $tar_header_length + $size > $max_file_size, splitting\n" if ($opts{d});          print STDERR "# tar file $current_tar_size + $tar_header_length + $size > $max_file_size, splitting\n" if ($opts{d});
636          new_tar_part();          new_tar_part();
637      }      }
638    

Legend:
Removed from v.236  
changed lines
  Added in v.251

  ViewVC Help
Powered by ViewVC 1.1.26