Branch Coverage

blib/lib/MogileFS/Worker/Query.pm
Criterion Covered Total %
branch 0 466 0.0


line true false branch
36 0 0 unless $cmd =~ /^[\w\d]+$/
56 0 0 unless (select $rout = $rin, undef, undef, 5)
63 0 0 unless ($rv)
64 0 0 if (defined $rv) { }
74 0 0 if ($self->process_generic_command(\$line)) { }
89 0 0 unless $$lineref =~ /^(\d+-\d+)?\s*(\S+)\s*(.*)/
103 0 0 if ($line =~ /^(\w+)\s*(.*)/)
111 0 0 if ($cmd_handler)
116 0 0 if ($@)
118 0 0 if ($errc eq 'dup') { }
150 0 0 if ($rv) { }
152 0 0 unless $dfid->add_to_db
167 0 0 unless defined $domain and length $domain
170 0 0 unless my $dmid = eval { do { Mgd::domain_factory()->get_by_name($domain)->id } }
186 0 0 if $$args{'crash'}
205 0 0 unless $$args{'dmid'} = $self->check_domain($args)
210 0 0 if $@
216 0 0 $$args{'multi_dest'} ? :
226 0 0 unless $$args{'debug_profile'}
230 0 0 $$args{'fid'} ? :
238 0 0 if (length $class)
239 0 0 unless $classid = eval { do { Mgd::class_factory()->get_by_name($dmid, $class)->id } }
252 0 0 if ($size)
254 0 0 if length $_->mb_free
258 0 0 unless (@devices)
263 0 0 unless (MogileFS::run_global_hook('cmd_create_open_order_devices', [@devices], \@devices))
270 0 0 $multi ? :
273 0 0 unless $ddev
274 0 0 unless $ddev->not_on_hosts(map({$_->host;} @dests))
278 0 0 unless @dests
289 0 0 unless ($fidid)
291 0 0 if $errc eq 'dup'
309 0 0 if (scalar keys %dir_done != scalar @dests)
321 0 0 if (@profpoints)
338 0 0 if ($multi) { }
380 0 0 unless $$args{'dmid'} = $self->check_domain($args)
388 0 0 unless my $fidid = $$args{'fid'}
389 0 0 unless my $devid = $$args{'devid'}
390 0 0 unless my $path = $$args{'path'}
393 0 0 if ($checksum)
395 0 0 if $@
402 0 0 unless $path eq $dfid->url
411 0 0 unless my $trow = $sto->delete_and_return_tempfile_row($fidid)
420 0 0 unless ($$trow{'devids'} =~ /\b$devid\b/)
427 0 0 unless (valid_key($key))
437 0 0 unless $$args{'size'}
438 0 0 if (not defined $size or $size == -1)
440 0 0 defined $size ? :
446 0 0 if ($$args{'size'} > -1 and $$args{'size'} != $size)
454 0 0 if ($checksum and $$args{'checksumverify'})
457 0 0 if ($actual ne $$checksum{'checksum'})
467 0 0 if ($old_fid)
470 0 0 unless $$old_fid{'fidid'} != $fidid
481 0 0 if $checksum
497 0 0 if (defined $rv and not $rv)
510 0 0 unless $$args{'dmid'} = $self->check_domain($args)
514 0 0 if defined $rv and not $rv
518 0 0 unless valid_key($key)
519 0 0 unless my $class = $$args{'class'}
521 0 0 unless my $classobj = Mgd::class_factory()->get_by_name($dmid, $class)
525 0 0 unless my $fid = 'MogileFS::FID'->new_from_dmid_and_key($dmid, $key)
529 0 0 unless @devids
531 0 0 if ($fid->classid != $classid)
544 0 0 unless $$args{'dmid'} = $self->check_domain($args)
548 0 0 if defined $rv and not $rv
555 0 0 unless valid_key($key)
558 0 0 unless my $fid = 'MogileFS::FID'->new_from_dmid_and_key($dmid, $key)
577 0 0 if ($$args{'fid'}) { }
583 0 0 unless $$args{'dmid'} = $self->check_domain($args)
584 0 0 unless valid_key($$args{'key'})
588 0 0 if defined $rv and not $rv
592 0 0 unless $fid
596 0 0 if ($fid)
619 0 0 if @devids
623 0 0 if ($checksum) { }
639 0 0 unless keys %$ret
648 0 0 unless $$args{'dmid'} = $self->check_domain($args)
652 0 0 if defined $rv and not $rv
659 0 0 unless valid_key($key)
665 0 0 unless $fid
672 0 0 if ($$class{'hashtype'})
674 0 0 if ($checksum) { }
686 0 0 if ($$args{'devices'})
701 0 0 if $count > 500 or $count < 0
704 0 0 unless $rows
705 0 0 unless @$rows
734 0 0 unless my $dmid = $self->check_domain($args)
737 0 0 if (defined $prefix and $prefix ne '')
739 0 0 if $after and not $after =~ /^$prefix/
745 0 0 if $limit > 1000
750 0 0 unless $keys and @$keys
756 0 0 if $key gt $$ret{'next_after'}
768 0 0 unless my $dmid = $self->check_domain($args)
770 0 0 unless (valid_key($fkey) and valid_key($tkey))
774 0 0 unless my $fid = 'MogileFS::FID'->new_from_dmid_and_key($dmid, $fkey)
777 0 0 unless $fid->rename($tkey)
789 0 0 if defined $$args{'hostid'} and $host->id != $$args{'hostid'}
808 0 0 if defined $$args{'devid'} and $dev->id != $$args{'devid'}
825 0 0 unless device_state($status)
829 0 0 unless $devid and $devid =~ /^\d+$/
834 0 0 if ($$args{'hostid'} and $$args{'hostid'} =~ /^\d+$/) { }
0 0 elsif (my $hname = $$args{'hostname'}) { }
836 0 0 unless $hostid
839 0 0 unless $hostid
844 0 0 if (eval { do { $sto->create_device($devid, $hostid, $status) } })
849 0 0 if $errc
857 0 0 unless my $domain = $$args{'domain'}
861 0 0 if ($@)
862 0 0 if (error_code($@) eq 'dup')
875 0 0 unless my $domain = $$args{'domain'}
879 0 0 unless my $dmid = $sto->get_domainid_by_name($domain)
882 0 0 if (eval { do { $sto->delete_domain($dmid) } })
887 0 0 if $err eq 'has_files'
888 0 0 if $err eq 'has_classes'
897 0 0 unless length $domain
900 0 0 unless length $class
903 0 0 unless $mindevcount > 0
906 0 0 if ($replpolicy)
910 0 0 if $@
914 0 0 if ($hashtype and $hashtype ne 'NONE')
916 0 0 unless $tmp
921 0 0 unless my $dmid = $sto->get_domainid_by_name($domain)
925 0 0 if (not defined $clsid and $$args{'update'} and $class eq 'default')
928 0 0 if ($$args{'update'}) { }
929 0 0 unless defined $clsid
934 0 0 if ($@)
935 0 0 if (error_code($@) eq 'dup')
944 0 0 if $replpolicy
946 0 0 if ($hashtype)
947 0 0 $hashtype eq 'NONE' ? :
968 0 0 unless length $domain
970 0 0 unless length $domain
972 0 0 if $class eq 'default'
975 0 0 unless my $dmid = $sto->get_domainid_by_name($domain)
978 0 0 unless defined $clsid
980 0 0 if (eval { do { Mgd::get_store()->delete_class($dmid, $clsid) } })
985 0 0 if $errc eq 'has_files'
993 0 0 unless my $hostname = $$args{'host'}
1001 0 0 if ($$args{'update'}) { }
1002 0 0 unless $hostid
1004 0 0 if $hostid
1005 0 0 unless $$args{'ip'}
1006 0 0 unless $$args{'port'}
1010 0 0 if ($$args{'status'})
1011 0 0 unless 'MogileFS::Host'->valid_state($$args{'status'})
1020 0 0 if exists $$args{'ip'}
1021 0 0 if exists $$args{'port'}
1022 0 0 if exists $$args{'getport'}
1044 0 0 unless my $hostid = $sto->get_hostid_by_name($$args{'host'})
1049 0 0 if $$dev{'hostid'} == $hostid
1098 0 0 unless $$args{'dmid'} = $self->check_domain($args)
1102 0 0 if defined $rv and not $rv
1109 0 0 unless valid_key($key)
1114 0 0 if $pathcount < 2
1120 0 0 if ($get_from_memc)
1121 0 0 if (my $fidid = $memc->get($mogfid_memkey)) { }
1127 0 0 unless ($fid)
1131 0 0 unless $fid
1135 0 0 if $need_fid_in_memcache or $memc and not $get_from_memc
1147 0 0 if ($get_from_memc)
1148 0 0 if (my $list = $memc->get($devid_memkey)) { }
1154 0 0 unless (@fid_devids)
1158 0 0 if $need_devids_in_memcache or $memc and not $get_from_memc
1164 0 0 unless (MogileFS::run_global_hook('cmd_get_paths_order_devices', \@devices, \@sorted_devs))
1176 0 0 unless $dev and $dev->host
1182 0 0 unless ($currently_up)
1189 0 0 unless $$ret{'paths'} or $$args{'noverify'} or $dfid->size_matches
1193 0 0 if ($dev->dstate->should_drain)
1200 0 0 if $n == $pathcount
1205 0 0 if ($$ret{'paths'} < $pathcount and @drain_paths)
1209 0 0 if $n == $pathcount
1214 0 0 if ($backup_path and not $$ret{'paths'})
1230 0 0 if (defined $util and $util =~ /\A\d+\Z/) { }
1276 0 0 unless $$args{'dmid'} = $self->check_domain($args)
1280 0 0 if defined $rv and not $rv
1287 0 0 unless valid_key($key)
1293 0 0 if (my $fidid = $memc->get($mogfid_memkey)) { }
1298 0 0 unless ($fid)
1302 0 0 unless $fid
1306 0 0 if $need_fid_in_memcache
1316 0 0 if (my $list = $memc->get($devid_memkey)) { }
1321 0 0 unless (@fid_devids)
1325 0 0 if $need_devids_in_memcache
1334 0 0 if (defined $util and $util =~ /\A\d+\Z/) { }
1354 0 0 if $dev
1370 0 0 unless ($newfid)
1372 0 0 if $errc eq 'dup'
1376 0 0 unless (Mgd::get_store()->remove_fidid_from_devid($fid->id, $devid))
1380 0 0 unless (Mgd::get_store()->add_fidid_to_devid($newfid, $devid))
1404 0 0 unless $hostname and $devid and $weight >= 0
1408 0 0 unless $dev
1409 0 0 unless $dev->host->hostname eq $hostname
1425 0 0 unless $hostname and $devid and $dstate
1429 0 0 unless $dev
1430 0 0 unless $dev->host->hostname eq $hostname
1434 0 0 unless $dev->can_change_to_state($state)
1457 0 0 unless my $key = $$args{'key'}
1461 0 0 unless my $chk = 'MogileFS::Config'->server_setting_is_writable($key)
1465 0 0 if $@
1472 0 0 if ($key =~ /^slave_/)
1483 0 0 unless $key
1494 0 0 unless 'MogileFS::Config'->server_setting_is_readable($k)
1517 0 0 if $fsck_host
1518 0 0 if $rebal_host
1521 0 0 unless 'MogileFS::Config'->server_setting($_[0])
1524 0 0 if ($checked_fid and $final_fid and $checked_fid >= $final_fid or not $final_fid || $checked_fid)
1526 0 0 unless $self->_do_fsck_reset
1557 0 0 $$args{'policy_only'} ? :
1559 0 0 $$args{'startpos'} ? :
1562 0 0 unless $self->_do_fsck_reset
1578 0 0 unless $k =~ /^fsck_sum_evcount_/
1585 0 0 if ($@)
1610 0 0 if defined $$row{$k}
1624 0 0 unless 'MogileFS::Config'->server_setting($_[0])
1625 0 0 $fsck_host ? :
1640 0 0 unless $k =~ /^fsck_sum_evcount_(.+)/
1653 0 0 unless $rebal_state
1663 0 0 if $rebal_host
1664 0 0 if $fsck_host
1667 0 0 unless ($rebal_state)
1669 0 0 unless $rebal_pol
1689 0 0 unless $rebal_pol
1711 0 0 if ($host)
1712 0 0 if $host
1721 0 0 unless ($host)
1733 0 0 if $rebal_host
1740 0 0 if ($@)
1753 0 0 if ($$self{'querystarttime'})
1758 0 0 defined $$self{'reqid'} ? :
1761 0 0 if defined $$self{'callid'}
1815 0 0 if ($$self{'querystarttime'}) { }
1824 0 0 defined $$self{'reqid'} ? :
1825 0 0 defined $$self{'callid'} ? :