Changeset 1325

Show
Ignore:
Timestamp:
10/18/09 08:12:22 (6 weeks ago)
Author:
dormando
Message:

Don't warn without size arg, still warn on error

If a client doesn't specify size= to create_close, used to cause a warning and
not check if the file was stored correctly.

Now it supports doing either and will always test the file.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/server/lib/MogileFS/Worker/Query.pm

    r1322 r1325  
    393393    my $size = MogileFS::HTTPFile->at($path)->size; 
    394394 
    395     if ($args->{size} >= 0 && (!defined($size) || $size == MogileFS::HTTPFile::FILE_MISSING)) { 
    396         # size check has been requested and that storage node is unreachable or the file is missing 
     395    # size check is optional? Needs to support zero byte files. 
     396    $args->{size} = -1 unless $args->{size}; 
     397    if (!defined($size) || $size == MogileFS::HTTPFile::FILE_MISSING) { 
     398        # storage node is unreachable or the file is missing 
    397399        my $type    = defined $size ? "missing" : "cantreach"; 
    398400        my $lasterr = MogileFS::Util::last_error(); 
     
    401403 
    402404    return $self->err_line("size_mismatch", "Expected: $args->{size}; actual: $size; path: $path") 
    403         if $args->{size} && ($args->{size} != $size); 
     405        if $args->{size} > -1 && ($args->{size} != $size); 
    404406 
    405407    # TODO: check for EIO?