Changeset 179

Show
Ignore:
Timestamp:
07/28/10 20:23:52 (4 years ago)
Author:
depesz
Message:

add ability to disable nice usage

Files:

Legend:

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

    r178 r179  
    11=head1 OmniPITR 
     2 
     3=head2 2010-07-28 
     4 
     5=over 
     6 
     7=item * Add forgotten --nice-path to omnipitr-archive 
     8 
     9=item * Add option not to use nice for omnipitr-archive, and both 
     10omnipitr-backup-* programs 
     11 
     12=back 
    213 
    314=head2 2010-07-15 
  • trunk/omnipitr/doc/omnipitr-archive.pod

    r178 r179  
    7474 
    7575Log verbosely what is happening. 
     76 
     77=item --not-nice (-nn) 
     78 
     79Do not use nice for compressions. 
     80 
     81=item --nice-path (-np) 
     82 
     83Full path to nice program - in case you can't set proper PATH environment 
     84variable. 
    7685 
    7786=item --gzip-path (-gp) 
  • trunk/omnipitr/doc/omnipitr-backup-master.pod

    r178 r179  
    8787Log verbosely what is happening. 
    8888 
     89=item --not-nice (-nn) 
     90 
     91Do not use nice for compressions. 
     92 
    8993=item --gzip-path (-gp) 
    9094 
  • trunk/omnipitr/doc/omnipitr-backup-slave.pod

    r178 r179  
    6969 
    7070Log verbosely what is happening. 
     71 
     72=item --not-nice (-nn) 
     73 
     74Do not use nice for compressions. 
    7175 
    7276=item --gzip-path (-gp) 
  • trunk/omnipitr/lib/OmniPITR/Program/Archive.pm

    r174 r179  
    143143        my $compressor_binary = $self->{ $compression . '-path' } || $compression; 
    144144 
    145         my $compression_command = sprintf 'nice %s --stdout %s > %s', $compressor_binary, quotemeta( $self->{ 'segment' } ), quotemeta( $compressed_filename ); 
     145        my $compression_command = sprintf '%s --stdout %s > %s', $compressor_binary, quotemeta( $self->{ 'segment' } ), quotemeta( $compressed_filename ); 
     146        unless ( $self->{ 'not-nice' } ) { 
     147            $compression_command = quotemeta( $self->{ 'nice-path' } ) . ' ' . $compression_command; 
     148        } 
    146149 
    147150        $self->log->time_start( 'Compressing with ' . $compression ) if $self->verbose; 
     
    257260        'lzma-path'  => 'lzma', 
    258261        'rsync-path' => 'rsync', 
     262        'nice-path'  => 'nice', 
    259263    ); 
    260264 
     
    275279        'state-dir|s=s', 
    276280        'temp-dir|t=s', 
     281        'nice-path|np=s', 
    277282        'verbose|v', 
     283        'not-nice|nn', 
    278284        ); 
    279285 
     
    281287    $args{ 'log' } =~ tr/^/%/; 
    282288 
    283     for my $key ( qw( data-dir dst-backup temp-dir state-dir pid-file verbose gzip-path bzip2-path lzma-path force-data-dir rsync-path ) ) { 
     289    for my $key ( qw( data-dir dst-backup temp-dir state-dir pid-file verbose gzip-path bzip2-path lzma-path nice-path force-data-dir rsync-path not-nice ) ) { 
    284290        $self->{ $key } = $args{ $key }; 
    285291    } 
  • trunk/omnipitr/lib/OmniPITR/Program/Backup.pm

    r175 r179  
    109109        } 
    110110 
    111         my @command = map { quotemeta $_ } ( $self->{ 'nice-path' }, $self->{ $type . '-path' }, '--stdout', '-' ); 
     111        my @command = map { quotemeta $_ } ( $self->{ $type . '-path' }, '--stdout', '-' ); 
     112        unshift @command, quotemeta( $self->{ 'nice-path' } ) unless $self->{ 'not-nice' }; 
    112113        push @command, ( '>', quotemeta( $full_file_path ) ); 
    113114 
     
    189190    $SIG{ 'PIPE' } = sub { $self->log->fatal( 'Got SIGPIPE while tarring %s for %s', $ARGS{ 'tar_dir' }, $self->{ 'sigpipeinfo' } ); }; 
    190191 
    191     my @compression_command = ( $self->{ 'nice-path' }, $self->{ 'tar-path' }, 'cf', '-' ); 
     192    my @compression_command = ( $self->{ 'tar-path' }, 'cf', '-' ); 
     193    unshift @compression_command, $self->{ 'nice-path' } unless $self->{ 'not-nice' }; 
    192194 
    193195    if ( $ARGS{ 'excludes' } ) { 
  • trunk/omnipitr/lib/OmniPITR/Program/Backup/Master.pm

    r175 r179  
    306306        'tar-path|tp=s', 
    307307        'rsync-path|rp=s', 
     308        'not-nice|nn', 
    308309        ); 
    309310 
  • trunk/omnipitr/lib/OmniPITR/Program/Backup/Slave.pm

    r175 r179  
    116116        copy( $old_file, $new_file ) or $self->log->fatal( 'Cannot copy %s to %s: %s', $old_file, $new_file, $OS_ERROR ); 
    117117        $self->log->log( 'File copied: %s -> %s', $old_file, $new_file ); 
    118         my $response = run_command( $self->{ 'temp-dir' }, $self->{ 'nice-path' }, $self->{ $self->{ 'source' }->{ 'compression' } . '-path' }, '-d', $new_file ); 
     118        my @uncompress = ( $self->{ $self->{ 'source' }->{ 'compression' } . '-path' }, '-d', $new_file ); 
     119        unshift @uncompress, $self->{ 'nice-path' } unless $self->{ 'not-nice' }; 
     120        my $response = run_command( $self->{ 'temp-dir' }, @uncompress ); 
    119121        if ( $response->{ 'error_code' } ) { 
    120122            $self->log->fatal( 'Error while uncompressing wal segment %s: %s', $new_file, $response ); 
     
    372374        'rsync-path|rp=s', 
    373375        'pgcontroldata-path|pp=s', 
     376        'not-nice|nn', 
    374377        ); 
    375378