Branch Coverage

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


line true false branch
33 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) { }
44 1 0 unless (eval "use $subclass; 1")
78 0 0 unless my $dbh = 'DBI'->connect($dsn, $args{'dbuser'}, $args{'dbpass'}, {'PrintError', 0})
88 0 0 if $sto
93 0 0 unless my $rdbh = 'DBI'->connect($rootdsn, $args{'dbrootuser'}, $args{'dbrootpass'}, {'PrintError', 0})
106 0 0 if $sto
115 0 0 unless $rdbh->do("CREATE DATABASE IF NOT EXISTS $dbname")
121 0 0 unless $rdbh->do("GRANT ALL PRIVILEGES ON $dbname.* TO $user\@'%' IDENTIFIED BY ?", undef, $pass)
124 0 0 unless $rdbh->do("GRANT ALL PRIVILEGES ON $dbname.* TO $user\@'localhost' IDENTIFIED BY ?", undef, $pass)
138 0 0 if $self->can_insertignore
139 0 0 if $self->can_replace
148 0 0 unless &$on_confirm($msg)
173 0 0 unless $self->can_do_slaves
186 0 0 if ($ver <= $$self{'slave_list_version'})
200 0 0 unless my $sk = 'MogileFS::Config'->server_setting_cached('slave_keys')
207 0 0 unless ($slave)
213 0 0 unless (defined $dsn and defined $user and defined $pass)
226 0 0 unless @temp
240 0 0 if defined $dead_timeout and $dead_timeout + $dead_retry * $dead_backoff > $now
242 0 0 if $$self{'connected_slaves'}{$$slave_fulldsn[0]}
249 0 0 if ($self->check_slave) { }
254 0 0 unless $dead_backoff > 20
263 0 0 unless $self->can_do_slaves
268 0 0 unless ($full_dsn)
275 0 0 unless ($self->_slaves_list_changed)
276 0 0 if ($$self{'slave'} = $self->_pick_slave)
278 0 0 if $self->check_slave
282 0 0 if ($$self{'slave'})
292 0 0 unless @slaves_list
296 0 0 unless (defined $slave_skip_filtering and $slave_skip_filtering eq 'on')
306 0 0 if ($$self{'slave'} = $self->_pick_slave)
316 0 0 unless $self->can_do_slaves
318 0 0 if ($$self{'slave_ok'})
319 0 0 if (my $slave = $self->get_slave)
331 0 0 unless ref $coderef eq 'CODE'
346 0 0 if ($$self{'dbh'})
347 0 0 if ($$self{'recheck_done_gen'} != $$self{'recheck_req_gen'})
348 0 0 unless $$self{'dbh'}->ping
352 0 0 if $$self{'max_handles'} and $$self{'handles_left'}-- < 0 and not $$self{'lock_depth'}
356 0 0 if $$self{'dbh'}
362 0 0 unless ($self->is_slave)
364 0 0 if defined $flag and $flag == 0
368 0 0 if ($$self{'lock_depth'})
384 0 0 if ($@ eq "timeout\n") { }
0 0 elsif ($@) { }
390 0 0 if $$self{'max_handles'}
394 0 0 if $_[0]{'dbh'}
404 0 0 unless $dbh->err
407 0 0 if $optmsg
409 0 0 if ($$dbh{'AutoCommit'} == 0)
416 0 0 unless $@ or $self->dbh->err
422 0 0 if scalar(@_) % 2
426 0 0 if %uarg
448 0 0 if $self->was_duplicate_error
449 0 0 if $@
462 0 0 if ($self->can_insertignore) { }
467 0 0 if ($@ or $dbh->err)
468 0 0 if $self->was_duplicate_error
484 0 0 if $tries < 1
489 0 0 if $self->was_deadlock_error
490 0 0 if $@
517 0 0 if ($curver == $latestver)
522 0 0 if ($curver > $latestver)
526 0 0 if ($curver)
568 0 0 if $self->table_exists($table)
573 0 0 unless $dbh->do($sql)
579 0 0 unless $dbh->do($sql)
842 0 0 unless ($self->column_type('class', 'replpolicy'))
849 0 0 unless ($self->column_type('class', 'hashtype'))
867 0 0 if ($self->domain_has_files($dmid)) { }
0 0 elsif ($self->domain_has_classes($dmid)) { }
879 0 0 if $err
882 0 0 if $err
890 0 0 $has_a_fid ? :
906 0 0 $has_a_fid ? :
919 0 0 if ($classname eq 'default') { }
930 0 0 if $rv
932 0 0 if ($@ or $dbh->err)
933 0 0 if ($self->was_duplicate_error)
935 0 0 if ($$dbh{'AutoCommit'} == 0)
940 0 0 if $rv
952 0 0 if $self->was_duplicate_error
1001 0 0 unless $self->can_replace
1004 0 0 if (defined $val) { }
1011 0 0 if $dbh->err
1018 0 0 unless defined $val
1019 0 0 unless $val
1021 0 0 if $self->dbh->do('UPDATE server_settings SET value=value+? WHERE field=?', undef, $val, $key) > 0
1060 0 0 $fid ? :
1080 0 0 if ($fid)
1088 0 0 unless ($rv)
1089 0 0 if $self->was_duplicate_error
1093 0 0 unless (defined $fid)
1096 0 0 unless $fid = $dbh->last_insert_id(undef, undef, 'tempfile', 'fid')
1099 0 0 unless defined $fid and $fid > 0
1103 0 0 unless (&$ins_tempfile())
1104 0 0 if $explicit_fid_used
1110 0 0 $exists ? :
1118 0 0 if $explicit_fid_used
1132 0 0 unless &$ins_tempfile()
1170 0 0 unless $self->dbh->selectcol_arrayref('SELECT devid FROM file_on WHERE fid=?', undef, $fidid)
1203 0 0 unless $rv > 0
1210 0 0 unless @keys
1244 0 0 unless $self->can_replace
1267 0 0 if $self->class_has_files($dmid, $cid)
1307 0 0 if $rows_deleted > 0
1313 0 0 unless $self->can_replace
1332 0 0 if ($@ or $dbh->err)
1334 0 0 if ($self->was_duplicate_error) { }
1355 0 0 unless $domains
1371 0 0 if ($self->cached_schema_version >= 10)
1373 0 0 if ($self->cached_schema_version >= 15)
1388 0 0 unless $fidid
1389 0 0 unless $devid
1396 0 0 if $rv > 0
1483 0 0 if ($in)
1500 0 0 unless $in
1513 0 0 unless $in
1517 0 0 if (ref $fidid) { }
1531 0 0 unless ($self->can_insert_multi and $self->can_replace || $self->can_insertignore)
1536 0 0 unless $in
1541 0 0 if (ref $$fidids[0] eq 'ARRAY') { }
1596 0 0 unless $devid
1600 0 0 if %o
1605 0 0 if ($age eq 'old') { }
0 0 elsif ($age eq 'new') { }
1606 0 0 if $fidid
1609 0 0 if $fidid
1616 0 0 if $fidid
1649 0 0 if ($self->was_duplicate_error)
1652 0 0 if $rv
1659 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