Changeset 173

Show
Ignore:
Timestamp:
06/28/10 20:16:00 (4 years ago)
Author:
depesz
Message:

Added code to exclude pg_log and pg_xlog if these are symlinks

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/omnipitr/doc/changes.pod

    r172 r173  
    99=item * Fix call to tar with 2 --transform options. Some tar versions don't 
    1010handle it well, and it's required for omnipitr-backup-slave 
     11 
     12=item * Exclude whole pg_log and pg_xlog directories if these are symlinks - no 
     13point in restoring them on slave system, and it's pretty common to be symlinked. 
    1114 
    1215=back 
  • trunk/omnipitr/lib/OmniPITR/Program/Backup/Master.pm

    r168 r173  
    236236    $self->start_writers( 'data' ); 
    237237 
     238    my @excludes = qw( pg_log/* pg_xlog/0* pg_xlog/archive_status/* postmaster.pid ); 
     239    for my $dir ( qw( pg_log pg_xlog ) ) { 
     240        push @excludes, $dir if -l File::Spec->catfile( $self->{ 'data-dir' }, $dir ); 
     241    } 
     242 
    238243    $self->tar_and_compress( 
    239244        'work_dir' => dirname( $self->{ 'data-dir' } ), 
    240245        'tar_dir'  => basename( $self->{ 'data-dir' } ), 
    241         'excludes' => [ qw( pg_log/* pg_xlog/0* pg_xlog/archive_status/* postmaster.pid ) ]
     246        'excludes' => \@excludes
    242247    ); 
    243248 
  • trunk/omnipitr/lib/OmniPITR/Program/Backup/Slave.pm

    r172 r173  
    343343    my $transform_command = sprintf 's#^%s/#%s/#', $transform_from, $transform_to; 
    344344 
     345    my @excludes = qw( pg_log/* pg_xlog/0* pg_xlog/archive_status/* recovery.conf postmaster.pid ); 
     346    for my $dir ( qw( pg_log pg_xlog ) ) { 
     347        push @excludes, $dir if -l File::Spec->catfile( $self->{ 'data-dir' }, $dir ); 
     348    } 
     349 
    345350    $self->tar_and_compress( 
    346351        'work_dir'  => dirname( $self->{ 'data-dir' } ), 
    347352        'tar_dir'   => [ basename( $self->{ 'data-dir' } ), File::Spec->catfile( $self->{ 'temp-dir' }, 'backup_label' ) ], 
    348         'excludes'  => [ map { sprintf( '%s/%s', basename( $self->{ 'data-dir' } ), $_ ) } qw( pg_log/* pg_xlog/0* pg_xlog/archive_status/* recovery.conf postmaster.pid ) ], 
     353        'excludes'  => [ map { sprintf( '%s/%s', basename( $self->{ 'data-dir' } ), $_ ) } @excludes ], 
    349354        'transform' => [ $transform_command ], 
    350355    );