Changeset 1147

Show
Ignore:
Timestamp:
02/05/08 23:48:18 (10 months ago)
Author:
hachi
Message:

r1328@miyako: hachi | 2008-02-05 15:44:41 -0800
Make a new server (config file) option 'rebalance_ignore_missing' which makes the rebalance process not spin in the case of a 404 when trying to delete a file. It's possible that this sort of behavior should be default on, but I would rather get the functionality now and make the decision later.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/server/lib/MogileFS/Config.pm

    r950 r1147  
    158158 
    159159    $old_repl_compat = choose_value( 'old_repl_compat', 1 ); 
     160    choose_value( 'rebalance_ignore_missing', 0 ); 
    160161 
    161162    choose_value( 'no_schema_check', 0 ); 
  • trunk/server/lib/MogileFS/DevFID.pm

    r981 r1147  
    124124sub destroy { 
    125125    my $self = shift; 
     126    my %opts = @_; 
     127 
    126128    my $httpfile = MogileFS::HTTPFile->at($self->url) 
    127129        or die "Creation of HTTPFile object failed."; 
    128130 
    129     $httpfile->delete 
     131    my %delete_opts; 
     132 
     133    $delete_opts{ignore_missing} = 1 
     134        if $opts{ignore_missing}; 
     135 
     136    $httpfile->delete(%delete_opts) 
    130137        or die "Deletion of file via HTTP failed."; 
    131138 
  • trunk/server/lib/MogileFS/HTTPFile.pm

    r952 r1147  
    5858sub delete { 
    5959    my $self = shift; 
     60    my %opts = @_; 
    6061    my ($host, $port) = ($self->{host}, $self->{port}); 
    6162 
     
    9192            my $rescode = $1; 
    9293            # make sure we get a good response 
     94            if ($rescode == 404 && $opts{ignore_missing}) { 
     95                $did_del = 1; 
     96                next; 
     97            } 
    9398            unless ($rescode == 204) { 
    9499                delete $http_socket{"$host:$port"}; 
  • trunk/server/lib/MogileFS/Worker/Replicate.pm

    r1114 r1147  
    458458    } 
    459459 
     460    my %destroy_opts; 
     461 
     462    $destroy_opts{ignore_missing} = 1 
     463        if MogileFS::Config->config("rebalance_ignore_missing"); 
     464 
    460465    if ($should_delete) { 
    461         eval { $devfid->destroy }; 
     466        eval { $devfid->destroy(%destroy_opts) }; 
    462467        if ($@) { 
    463468            return $fail->("HTTP delete (due to '$del_reason') failed: $@");