Branch Coverage

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


line true false branch
35 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) { }
46 1 0 unless (eval "use $subclass; 1")
81 0 0 unless my $dbh = 'DBI'->connect($dsn, $args{'dbuser'}, $args{'dbpass'}, {'PrintError', 0})
90 0 0 if $sto
96 0 0 unless my $rdbh = 'DBI'->connect($rootdsn, $args{'dbrootuser'}, $args{'dbrootpass'}, {'PrintError', 0})
108 0 0 if $sto
117 0 0 unless $rdbh->do("CREATE DATABASE IF NOT EXISTS $dbname")
123 0 0 unless $rdbh->do("GRANT ALL PRIVILEGES ON $dbname.* TO $user\@'%' IDENTIFIED BY ?", undef, $pass)
126 0 0 unless $rdbh->do("GRANT ALL PRIVILEGES ON $dbname.* TO $user\@'localhost' IDENTIFIED BY ?", undef, $pass)
140 0 0 if $self->can_insertignore
141 0 0 if $self->can_replace
150 0 0 unless &$on_confirm($msg)
175 0 0 unless $self->can_do_slaves
188 0 0 if ($ver <= $self->{'slave_list_version'})
202 0 0 unless my $sk = 'MogileFS::Config'->server_setting_cached('slave_keys')
209 0 0 unless ($slave)
215 0 0 unless (defined $dsn and defined $user and defined $pass)
228 0 0 unless @temp
242 0 0 if defined $dead_timeout and $dead_timeout + $dead_retry * $dead_backoff > $now
244 0 0 if $self->{'connected_slaves'}{$slave_fulldsn->[0]}
251 0 0 if ($self->check_slave) { }
256 0 0 unless $dead_backoff > 20
265 0 0 unless $self->can_do_slaves
270 0 0 unless ($full_dsn)
277 0 0 unless ($self->_slaves_list_changed)
278 0 0 if ($self->{'slave'} = $self->_pick_slave)
280 0 0 if $self->check_slave
284 0 0 if ($self->{'slave'})
294 0 0 unless @slaves_list
298 0 0 unless (defined $slave_skip_filtering and $slave_skip_filtering eq 'on')
308 0 0 if ($self->{'slave'} = $self->_pick_slave)
318 0 0 unless $self->can_do_slaves
320 0 0 if ($self->{'slave_ok'})
321 0 0 if (my $slave = $self->get_slave)
333 0 0 unless ref $coderef eq 'CODE'
348 0 0 if ($self->{'dbh'})
349 0 0 if ($self->{'recheck_done_gen'} != $self->{'recheck_req_gen'})
350 0 0 unless $self->{'dbh'}->ping
355 0 0 if $self->{'max_handles'} and $self->{'handles_left'}-- < 0 and not $self->{'lock_depth'}
358 0 0 if $self->{'dbh'}
364 0 0 unless ($self->is_slave)
366 0 0 if defined $flag and $flag == 0
370 0 0 if ($self->{'lock_depth'})
386 0 0 if ($@ eq "timeout\n") { }
0 0 elsif ($@) { }
392 0 0 if $self->{'max_handles'}
396 0 0 if $_[0]{'dbh'}
406 0 0 unless $dbh->err
409 0 0 if $optmsg
411 0 0 if ($dbh->{'AutoCommit'} == 0)
418 0 0 unless $@ or $self->dbh->err
424 0 0 if scalar(@_) % 2
428 0 0 if %uarg
450 0 0 if $self->was_duplicate_error
451 0 0 if $@
464 0 0 if ($self->can_insertignore) { }
469 0 0 if ($@ or $dbh->err)
470 0 0 if $self->was_duplicate_error
486 0 0 if $tries < 1
491 0 0 if $self->was_deadlock_error
492 0 0 if $@
519 0 0 if ($curver == $latestver)
524 0 0 if ($curver > $latestver)
528 0 0 if ($curver)
571 0 0 if $self->table_exists($table)
576 0 0 unless $dbh->do($sql)
582 0 0 unless $dbh->do($sql)
845 0 0 unless ($self->column_type('class', 'replpolicy'))
852 0 0 unless ($self->column_type('class', 'hashtype'))
870 0 0 if ($self->domain_has_files($dmid)) { }
0 0 elsif ($self->domain_has_classes($dmid)) { }
882 0 0 if $err
885 0 0 if $err
893 0 0 $has_a_fid ? :
909 0 0 $has_a_fid ? :
922 0 0 if ($classname eq 'default') { }
933 0 0 if $rv
935 0 0 if ($@ or $dbh->err)
936 0 0 if ($self->was_duplicate_error)
938 0 0 if ($dbh->{'AutoCommit'} == 0)
943 0 0 if $rv
955 0 0 if $self->was_duplicate_error
1004 0 0 unless $self->can_replace
1007 0 0 if (defined $val) { }
1014 0 0 if $dbh->err
1021 0 0 unless defined $val
1022 0 0 unless $val
1024 0 0 if $self->dbh->do('UPDATE server_settings SET value=value+? WHERE field=?', undef, $val, $key) > 0
1063 0 0 $fid ? :
1083 0 0 if ($fid)
1091 0 0 unless ($rv)
1092 0 0 if $self->was_duplicate_error
1096 0 0 unless (defined $fid)
1099 0 0 unless $fid = $dbh->last_insert_id(undef, undef, 'tempfile', 'fid')
1102 0 0 unless defined $fid and $fid > 0
1106 0 0 unless (&$ins_tempfile())
1107 0 0 if $explicit_fid_used
1113 0 0 $exists ? :
1121 0 0 if $explicit_fid_used
1135 0 0 unless &$ins_tempfile()
1173 0 0 unless $self->dbh->selectcol_arrayref('SELECT devid FROM file_on WHERE fid=?', undef, $fidid)
1206 0 0 unless $rv > 0
1213 0 0 unless @keys
1275 0 0 if $self->class_has_files($dmid, $cid)
1315 0 0 if $rows_deleted > 0
1321 0 0 unless $self->can_replace
1340 0 0 if ($@ or $dbh->err)
1342 0 0 if ($self->was_duplicate_error) { }
1363 0 0 unless $domains
1379 0 0 if ($self->cached_schema_version >= 10)
1381 0 0 if ($self->cached_schema_version >= 15)
1396 0 0 unless $fidid
1397 0 0 unless $devid
1404 0 0 if $rv > 0
1491 0 0 if ($in)
1508 0 0 unless $in
1521 0 0 unless $in
1525 0 0 if (ref $fidid) { }
1539 0 0 unless ($self->can_insert_multi and $self->can_replace || $self->can_insertignore)
1544 0 0 unless $in
1549 0 0 if (ref $fidids->[0] eq 'ARRAY') { }
1604 0 0 unless $devid
1608 0 0 if %o
1613 0 0 if ($age eq 'old') { }
0 0 elsif ($age eq 'new') { }
1614 0 0 if $fidid
1617 0 0 if $fidid
1624 0 0 if $fidid
1657 0 0 if ($self->was_duplicate_error)
1660 0 0 if $rv
1667 0 0 unless @keys
1688 0 0 if $rv
1697 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')
1726 0 0 unless $self->lock_queue($queue)
1730 0 0 if $extfields
1742 0 0 if $self->can_for_update
1750 0 0 unless ($fidlist)
1754 0 0 if ($self->was_deadlock_error) { }
1764 0 0 if ($dbh->{'AutoCommit'} == 0)
1767 0 0 defined $work ? :
1798 0 0 if $self->get_lock($lockname, 1)
1897 0 0 unless defined $prefix
1903 0 0 unless defined $after
1927 0 0 unless @devfids
1929 0 0 if (@devfids > 1 and not $self->can_insert_multi)
1937 0 0 unless $fidid
1938 0 0 unless $devid
1959 0 0 unless $self->dbh->selectcol_arrayref("\n SELECT fid\n FROM file_to_delete_later\n WHERE delafter < $ut\n LIMIT 500\n ")
1973 0 0 if (@fidids > 1 and not $self->can_insert_multi && ($self->can_replace || $self->can_insertignore))
1990 0 0 if (@fidids > 1 and not $self->can_insert_multi && ($self->can_replace || $self->can_insertignore))
2021 0 0 if defined $lock and $lock == 0
2037 0 0 if $lock
2048 0 0 if %opts
2093 0 0 if %opts
2097 0 0 if ($timegte)
2105 0 0 if ($logr)
2128 0 0 unless my $sk = 'MogileFS::Config'->server_setting('slave_keys')
2135 0 0 unless ($slave)
2141 0 0 unless (defined $dsn and defined $user and defined $pass)
2148 0 0 unless @slaves
2158 0 0 if $self->{'lock_depth'}
2179 0 0 unless $self->can_replace