Branch Coverage

blib/lib/MogileFS/Store.pm
Criterion Covered Total %
branch 3 330 0.9


line true false branch
34 0 1 if ($dsn =~ /^DBI:mysql:/i) { }
1 0 elsif ($dsn =~ /^DBI:SQLite:/i) { }
0 0 elsif ($dsn =~ /^DBI:Oracle:/i) { }
0 0 elsif ($dsn =~ /^DBI:Pg:/i) { }
45 1 0 unless (eval "use $subclass; 1")
79 0 0 unless my $dbh = 'DBI'->connect($dsn, $args{'dbuser'}, $args{'dbpass'}, {'PrintError', 0})
89 0 0 if $sto
94 0 0 unless my $rdbh = 'DBI'->connect($rootdsn, $args{'dbrootuser'}, $args{'dbrootpass'}, {'PrintError', 0})
107 0 0 if $sto
116 0 0 unless $rdbh->do("CREATE DATABASE IF NOT EXISTS $dbname")
122 0 0 unless $rdbh->do("GRANT ALL PRIVILEGES ON $dbname.* TO $user\@'%' IDENTIFIED BY ?", undef, $pass)
125 0 0 unless $rdbh->do("GRANT ALL PRIVILEGES ON $dbname.* TO $user\@'localhost' IDENTIFIED BY ?", undef, $pass)
139 0 0 if $self->can_insertignore
140 0 0 if $self->can_replace
149 0 0 unless &$on_confirm($msg)
174 0 0 unless $self->can_do_slaves
187 0 0 if ($ver <= $$self{'slave_list_version'})
201 0 0 unless my $sk = 'MogileFS::Config'->server_setting_cached('slave_keys')
208 0 0 unless ($slave)
214 0 0 unless (defined $dsn and defined $user and defined $pass)
227 0 0 unless @temp
241 0 0 if defined $dead_timeout and $dead_timeout + $dead_retry * $dead_backoff > $now
243 0 0 if $$self{'connected_slaves'}{$$slave_fulldsn[0]}
250 0 0 if ($self->check_slave) { }
255 0 0 unless $dead_backoff > 20
264 0 0 unless $self->can_do_slaves
269 0 0 unless ($full_dsn)
276 0 0 unless ($self->_slaves_list_changed)
277 0 0 if ($$self{'slave'} = $self->_pick_slave)
279 0 0 if $self->check_slave
283 0 0 if ($$self{'slave'})
293 0 0 unless @slaves_list
297 0 0 unless (defined $slave_skip_filtering and $slave_skip_filtering eq 'on')
307 0 0 if ($$self{'slave'} = $self->_pick_slave)
317 0 0 unless $self->can_do_slaves
319 0 0 if ($$self{'slave_ok'})
320 0 0 if (my $slave = $self->get_slave)
332 0 0 unless ref $coderef eq 'CODE'
347 0 0 if ($$self{'dbh'})
348 0 0 if ($$self{'recheck_done_gen'} != $$self{'recheck_req_gen'})
349 0 0 unless $$self{'dbh'}->ping
353 0 0 if $$self{'max_handles'} and $$self{'handles_left'}-- < 0 and not $$self{'lock_depth'}
357 0 0 if $$self{'dbh'}
363 0 0 unless ($self->is_slave)
365 0 0 if defined $flag and $flag == 0
369 0 0 if ($$self{'lock_depth'})
385 0 0 if ($@ eq "timeout\n") { }
0 0 elsif ($@) { }
391 0 0 if $$self{'max_handles'}
395 0 0 if $_[0]{'dbh'}
405 0 0 unless $dbh->err
408 0 0 if $optmsg
410 0 0 if ($$dbh{'AutoCommit'} == 0)
417 0 0 unless $@ or $self->dbh->err
423 0 0 if scalar(@_) % 2
427 0 0 if %uarg
449 0 0 if $self->was_duplicate_error
450 0 0 if $@
463 0 0 if ($self->can_insertignore) { }
468 0 0 if ($@ or $dbh->err)
469 0 0 if $self->was_duplicate_error
485 0 0 if $tries < 1
490 0 0 if $self->was_deadlock_error
491 0 0 if $@
518 0 0 if ($curver == $latestver)
523 0 0 if ($curver > $latestver)
527 0 0 if ($curver)
569 0 0 if $self->table_exists($table)
574 0 0 unless $dbh->do($sql)
580 0 0 unless $dbh->do($sql)
843 0 0 unless ($self->column_type('class', 'replpolicy'))
850 0 0 unless ($self->column_type('class', 'hashtype'))
868 0 0 if ($self->domain_has_files($dmid)) { }
0 0 elsif ($self->domain_has_classes($dmid)) { }
880 0 0 if $err
883 0 0 if $err
891 0 0 $has_a_fid ? :
907 0 0 $has_a_fid ? :
920 0 0 if ($classname eq 'default') { }
931 0 0 if $rv
933 0 0 if ($@ or $dbh->err)
934 0 0 if ($self->was_duplicate_error)
936 0 0 if ($$dbh{'AutoCommit'} == 0)
941 0 0 if $rv
953 0 0 if $self->was_duplicate_error
1002 0 0 unless $self->can_replace
1005 0 0 if (defined $val) { }
1012 0 0 if $dbh->err
1019 0 0 unless defined $val
1020 0 0 unless $val
1022 0 0 if $self->dbh->do('UPDATE server_settings SET value=value+? WHERE field=?', undef, $val, $key) > 0
1061 0 0 $fid ? :
1081 0 0 if ($fid)
1089 0 0 unless ($rv)
1090 0 0 if $self->was_duplicate_error
1094 0 0 unless (defined $fid)
1097 0 0 unless $fid = $dbh->last_insert_id(undef, undef, 'tempfile', 'fid')
1100 0 0 unless defined $fid and $fid > 0
1104 0 0 unless (&$ins_tempfile())
1105 0 0 if $explicit_fid_used
1111 0 0 $exists ? :
1119 0 0 if $explicit_fid_used
1133 0 0 unless &$ins_tempfile()
1171 0 0 unless $self->dbh->selectcol_arrayref('SELECT devid FROM file_on WHERE fid=?', undef, $fidid)
1204 0 0 unless $rv > 0
1211 0 0 unless @keys
1273 0 0 if $self->class_has_files($dmid, $cid)
1313 0 0 if $rows_deleted > 0
1319 0 0 unless $self->can_replace
1338 0 0 if ($@ or $dbh->err)
1340 0 0 if ($self->was_duplicate_error) { }
1361 0 0 unless $domains
1377 0 0 if ($self->cached_schema_version >= 10)
1379 0 0 if ($self->cached_schema_version >= 15)
1394 0 0 unless $fidid
1395 0 0 unless $devid
1402 0 0 if $rv > 0
1489 0 0 if ($in)
1506 0 0 unless $in
1519 0 0 unless $in
1523 0 0 if (ref $fidid) { }
1537 0 0 unless ($self->can_insert_multi and $self->can_replace || $self->can_insertignore)
1542 0 0 unless $in
1547 0 0 if (ref $$fidids[0] eq 'ARRAY') { }
1602 0 0 unless $devid
1606 0 0 if %o
1611 0 0 if ($age eq 'old') { }
0 0 elsif ($age eq 'new') { }
1612 0 0 if $fidid
1615 0 0 if $fidid
1622 0 0 if $fidid
1655 0 0 if ($self->was_duplicate_error)
1658 0 0 if $rv
1665 0 0 unless @keys
1686 0 0 if $rv
1695 0 0 unless my $to_repl_map = $self->dbh->selectall_hashref("\n SELECT fid, fromdevid, failcount, flags, nexttry\n FROM file_to_replicate\n WHERE nexttry <= $ut\n ORDER BY nexttry\n LIMIT $limit\n ", 'fid')
1724 0 0 unless $self->lock_queue($queue)
1728 0 0 if $extfields
1740 0 0 if $self->can_for_update
1748 0 0 unless ($fidlist)
1752 0 0 if ($self->was_deadlock_error) { }
1762 0 0 if ($$dbh{'AutoCommit'} == 0)
1765 0 0 defined $work ? :
1796 0 0 if $self->get_lock($lockname, 1)
1895 0 0 unless defined $prefix
1901 0 0 unless defined $after
1925 0 0 unless @devfids
1927 0 0 if (@devfids > 1 and not $self->can_insert_multi)
1935 0 0 unless $fidid
1936 0 0 unless $devid
1957 0 0 unless $self->dbh->selectcol_arrayref("\n SELECT fid\n FROM file_to_delete_later\n WHERE delafter < $ut\n LIMIT 500\n ")
1971 0 0 if (@fidids > 1 and not $self->can_insert_multi && ($self->can_replace || $self->can_insertignore))
1988 0 0 if (@fidids > 1 and not $self->can_insert_multi && ($self->can_replace || $self->can_insertignore))
2019 0 0 if defined $lock and $lock == 0
2035 0 0 if $lock
2046 0 0 if %opts
2091 0 0 if %opts
2095 0 0 if ($timegte)
2103 0 0 if ($logr)
2126 0 0 unless my $sk = 'MogileFS::Config'->server_setting('slave_keys')
2133 0 0 unless ($slave)
2139 0 0 unless (defined $dsn and defined $user and defined $pass)
2146 0 0 unless @slaves
2156 0 0 if $$self{'lock_depth'}
2177 0 0 unless $self->can_replace