Branch Coverage

blib/lib/MogileFS/Worker/Replicate.pm
Criterion Covered Total %
branch 0 250 0.0


line true false branch
38 0 0 unless @$queue_todo or @$queue_todo2
40 0 0 unless $self->validate_dbh
82 0 0 if $todo->{'fromdevid'}
86 0 0 if ($status)
96 0 0 if $unlock
100 0 0 if $Mgd::DEBUG >= 2
125 0 0 if ($errcode eq 'failed_getting_lock')
126 0 0 if $unlock
134 0 0 if ($type eq 'end_of_time') { }
0 0 elsif ($type eq 'offset') { }
149 0 0 if ($errcode eq 'no_source')
151 0 0 if $unlock
159 0 0 if ($errcode eq 'too_happy')
160 0 0 if $unlock
171 0 0 if ($dev->can_delete_from and $dev->should_read_from)
176 0 0 if ($devfid)
177 0 0 if ($self->rebalance_devfid($devfid))
190 0 0 if $unlock
208 0 0 unless $fid->exists
225 0 0 unless ($ret or $errcode eq 'too_happy')
232 0 0 if ($errcode eq 'too_happy' or $ret eq 'lost_race') { }
0 0 elsif ($ret eq 'would_worsen') { }
241 0 0 if ($devfid->exists) { }
248 0 0 if $test_df->devid == $devfid->devid
249 0 0 if ($test_df->size_matches)
272 0 0 if 'MogileFS::Config'->config('rebalance_ignore_missing')
275 0 0 if ($should_delete)
277 0 0 if ($@)
301 0 0 unless ref $fid
304 0 0 if $Mgd::DEBUG >= 2
312 0 0 if %opts
313 0 0 unless ref $mask_devids eq 'HASH'
325 0 0 if (@_ == 2) { }
331 0 0 if $errref
334 0 0 if ($errcode and $errcode eq 'failed_getting_lock') { }
339 0 0 $rv ? :
341 0 0 if ($no_unlock) { }
342 0 0 unless wantarray
345 0 0 if wantarray
352 0 0 unless my $devs = Mgd::device_factory()->map_by_id
355 0 0 unless $sto->should_begin_replicating_fidid($fidid)
360 0 0 unless $fid->exists
371 0 0 unless my $d = Mgd::device_factory()->get_by_id($devid)
374 0 0 if ($d->dstate->should_have_files and not $mask_devids->{$devid})
377 0 0 if ($d->should_read_from)
382 0 0 if @on_devs == 0
383 0 0 if @on_up_devid == 0
385 0 0 if ($fixed_source and not grep({$_ == $fixed_source;} @on_up_devid))
395 0 0 if (@$target_devids)
409 0 0 if $rr->is_happy
413 0 0 if (@ddevs = $rr->copy_to_one_of_ideally) { }
0 0 elsif (@ddevs = $rr->copy_to_one_of_desperate) { }
414 0 0 if (my(@not_masked_ids) = grep({not $mask_devids->{$_} || $avoid_devids->{$_};} map({$_->id;} @ddevs))) { }
452 0 0 if ($dest_failed{$ddevid})
459 0 0 if (grep {$_->id == $ddevid;} @on_devs)
468 0 0 unless @choices
469 0 0 if ($fixed_source and grep {$_ == $fixed_source;} @choices) { }
478 0 0 unless my $worker = 'MogileFS::ProcManager'->is_child
481 0 0 if $fid_checksum
482 0 0 if $cls->hashtype
492 0 0 unless $rv or $copy_err =~ /^(?:src|dest)_error$/
494 0 0 unless ($rv)
496 0 0 if ($copy_err eq 'src_error') { }
499 0 0 if ($fixed_source and $fixed_source == $sdevid)
511 0 0 if ($digest and not $fid->checksum)
521 0 0 if ($rr->too_happy)
525 0 0 if ($rr->is_happy)
526 0 0 if $got_copy_request
546 0 0 unless wait_for_readability(fileno $sock, 45)
549 0 0 if (defined $r) { }
0 0 elsif ($!{'EAGAIN'} or $!{'EINTR'}) { }
550 0 0 if $r == 0
562 0 0 unless $head =~ m[\AHTTP/(\d+\.\d+)\s+(\d+)]
566 0 0 if ($line =~ /\AConnection:\s*keep-alive\s*\z/is) { }
0 0 elsif ($line =~ /\AConnection:\s*close\s*\z/is) { }
0 0 elsif ($line =~ /\AContent-Length:\s*(\d+)\s*\z/is) { }
588 0 0 if %opts
590 0 0 unless ref $fid
597 0 0 if ($fid_checksum and $fid_checksum->hashname eq 'MD5')
609 0 0 if $errref
610 0 0 if $sconn
611 0 0 if $dconn
632 0 0 unless $sdev and $ddev
642 0 0 if ('MogileFS::Config'->config('repl_use_get_port'))
646 0 0 unless (defined $spath and defined $dpath and defined $shostip and defined $dhostip and $sport and $dport)
672 0 0 if $shttphost
679 0 0 if $sconn
681 0 0 if $dconn
684 0 0 unless $sconn = $shost->http_conn_get(\%sopts)
687 0 0 unless ($sock->write("$get\r\n"))
688 0 0 if $sconn->retryable and $stries == 1
694 0 0 unless ($sres)
695 0 0 if $sconn->retryable and $stries == 1
698 0 0 unless ($sres->{'code'} >= 200 and $sres->{'code'} <= 299)
703 0 0 if $clen != $expected_clen
708 0 0 unless $dconn = $dhost->http_conn_get
712 0 0 unless ($dsock->write($put))
713 0 0 if $dconn->retryable and $dtries == 1
721 0 0 if $remain < $bytes_to_read
725 0 0 unless (defined $bytes)
728 0 0 unless (defined $bytes)
729 0 0 if ($!{'EAGAIN'} or $!{'EINTR'})
730 0 0 if wait_for_readability(fileno $sock, 45)
735 0 0 if ($bytes == 0)
742 0 0 if $remain < $bytes_to_read
743 0 0 if $digest
750 0 0 unless (defined $wbytes)
753 0 0 if not $wcount and $dconn->retryable and $dtries == 1
759 0 0 if $data_len == $wbytes
765 0 0 if $bytes_to_read < 0
769 0 0 if ($sres->{'keep'}) { }
777 0 0 if $digest
779 0 0 if ($fid_checksum)
780 0 0 if ($digest ne $fid_checksum->{'checksum'})
789 0 0 unless ($dres)
790 0 0 if not $wcount and $dconn->retryable and $dtries == 1
797 0 0 if ($dlen > 0) { }
0 0 elsif ($dlen < 0) { }
799 0 0 if (defined $r) { }
800 0 0 if ($r != $dlen)
816 0 0 if ($dres->{'keep'}) { }
823 0 0 if ($dres->{'code'} >= 200 and $dres->{'code'} <= 299)
824 0 0 if ($digest)
827 0 0 if ($ddev->{'reject_bad_md5'} and $alg eq 'MD5')
834 0 0 if ($actual ne $digest)