« blib/lib/Langertha/Holmgang/Sim/Linux/MariaDB.pm
↑ Summary
blib/lib/Langertha/Holmgang/Sim/Linux/Kubernetes.pm »
| 1 | package Langertha::Holmgang::Sim::Linux::Redis; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Redis on a simulated Linux server — redis-cli, CONFIG GET/SET/REWRITE, INFO, BGSAVE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use JSON::MaybeXS (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use Langertha::Holmgang::Shell (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Langertha::Holmgang::Sim::Linux (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | our $VERSION = '0.001'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 4 | our @GAPS; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 4 | our %REAL_CMD; # echte Redis-Befehle ohne Nachbildung (unten) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # Vorgaben von Redis 7.0 (Debian 12); Werte wie CONFIG GET sie zeigt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 4 | our %DEFAULT = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | bind => '127.0.0.1 -::1', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | port => '6379', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 'protected-mode' => 'yes', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | requirepass => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | masterauth => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | masteruser => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | maxmemory => '0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 'maxmemory-policy' => 'noeviction', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 'maxmemory-samples' => '5', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | maxclients => '10000', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | save => '3600 1 300 100 60 10000', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | appendonly => 'no', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | appendfsync => 'everysec', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | dir => '/var/lib/redis', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | dbfilename => 'dump.rdb', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | timeout => '0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 'tcp-keepalive' => '300', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 'tcp-backlog' => '511', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | databases => '16', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | loglevel => 'notice', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | logfile => '/var/log/redis/redis-server.log', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | daemonize => 'yes', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | supervised => 'auto', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | pidfile => '/run/redis/redis-server.pid', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 'stop-writes-on-bgsave-error' => 'yes', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 'rdbcompression' => 'yes', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 'replica-read-only' => 'yes', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 'replica-serve-stale-data' => 'yes', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 'lazyfree-lazy-eviction' => 'no', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 'slowlog-log-slower-than' => '10000', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 'slowlog-max-len' => '128', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 'notify-keyspace-events' => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 4 | our %IMMUTABLE = map { $_ => 1 } qw( daemonize supervised databases pidfile ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 4 | our %BYTES = map { $_ => 1 } qw( maxmemory ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 4 | our %BOOL = map { $_ => 1 } qw( protected-mode appendonly daemonize stop-writes-on-bgsave-error rdbcompression | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | replica-read-only replica-serve-stale-data lazyfree-lazy-eviction ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 4 | our %ENUM = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 'maxmemory-policy' => [qw( volatile-lru allkeys-lru volatile-lfu allkeys-lfu volatile-random allkeys-random volatile-ttl noeviction )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | appendfsync => [qw( always everysec no )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | loglevel => [qw( debug verbose notice warning nothing )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | supervised => [qw( upstart systemd auto no )], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 4 | our %ALIAS = ( slaveof => 'replicaof', 'slave-read-only' => 'replica-read-only', 'slave-serve-stale-data' => 'replica-serve-stale-data' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 10 | ▶ | sub _bytes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_bytes: called CC=4 SCAR=15.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 10 | my ($v) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 10 | ▶ | return undef unless defined $v && $v =~ /\A\s*(\d+)\s*(b|k|kb|m|mb|g|gb)?\s*\z/i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $v and $v =~ /\A\s*(\d+)\s*(b|k|kb|m|mb|g|gb)?\s*\z/i
MC/DC0%0/2
defined $v and $v =~ /\A\s*(\d+)\s*(b|k|kb|m|mb|g|gb)?\s*\z/i
defined $v
$v =~ /\A\s*(\d+)\s*(b|k|kb|m|mb|g|gb)?\s*\z/i
Truth table33%1/3
A and B
A= defined $vB= $v =~ /\A\s*(\d+)\s*(b|k|kb|m|mb|g|gb)?\s*\z/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 10 | my %f = ( '' => 1, b => 1, k => 1000, kb => 1024, m => 1000_000, mb => 1024**2, g => 1000_000_000, gb => 1024**3 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 10 | ▶ | return $1 * $f{ lc( $2 // '' ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$2 // ""
MC/DC0%0/1
$2 // ""
$2
Truth table50%1/2
A
A= $2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | ▶ | sub _human_bytes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_human_bytes: called CC=4 SCAR=16.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | my ($n) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 1 | for ( [ 1024**3, 'gb' ], [ 1024**2, 'mb' ], [ 1024, 'kb' ] ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 1 | ▶ | return ( $n / $_->[0] ) . $_->[1] if $n && $n % $_->[0] == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$n and $n % $$_[0] == 0
MC/DC0%0/2
$n and $n % $$_[0] == 0
$n
$n % $$_[0] == 0
Truth table33%1/3
A and B
A= $nB= $n % $$_[0] == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | return "$n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 12 | ▶ | sub _info_human { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_info_human: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 12 | my ($n) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 12 | ▶ | for ( [ 1024**3, 'G' ], [ 1024**2, 'M' ], [ 1024, 'K' ] ) { return sprintf( '%.2f%s', $n / $_->[0], $_->[1] ) if $n >= $_->[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 3 | return "${n}B"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 15 | ▶ | sub _file_text { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_file_text: called CC=5 SCAR=16.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 15 | my ( $dev, $p ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 15 | ▶ | my $e = ( $dev->{files} || {} )->{$p}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$dev{'files'} || {}
MC/DC0%0/1
$$dev{'files'} || {}
$$dev{'files'}
Truth table50%1/2
A
A= $$dev{'files'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 15 | ▶ | return undef unless defined $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 14 | ▶ | return ref $e eq 'HASH' ? $e->{content} // '' : $e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$e{"content"} // ""
MC/DC0%0/1
$$e{"content"} // ""
$$e{"content"}
Truth table50%1/2
A
A= $$e{"content"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 1 | ▶ | sub _set_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_file: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | my ( $dev, $p, $t ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 1 | my $e = $dev->{files}{$p}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | ▶ | if ( ref $e eq 'HASH' ) { my %n = %$e; delete @n{qw( size link )}; $n{content} = $t; $dev->{files}{$p} = \%n } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | else { $dev->{files}{$p} = $t } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | # Wert pruefen und normalisieren: ( wert ) oder ( undef, fehlertext ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 66 | ▶ | sub _check_value { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_value: called CC=11 SCAR=26.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 66 | my ( $k, $v ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 66 | ▶ | $v //= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$v //= ""
MC/DC0%0/1
$v //= ""
$v
Truth table50%1/2
A
A= $v
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 66 | ▶ | if ( $BYTES{$k} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 10 | ▶ | my $b = _bytes($v) // return ( undef, "argument must be a memory value" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_bytes($v) // (return undef, "argument must be a memory value")
MC/DC0%0/1
_bytes($v) // (return undef, "argument must be a memory value")
_bytes($v)
Truth table50%1/2
A
A= _bytes($v)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 10 | return ("$b"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 56 | ▶ | if ( $BOOL{$k} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my $x = lc $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | return ( undef, "argument must be 'yes' or 'no'" ) unless $x eq 'yes' || $x eq 'no'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$x eq "yes" or $x eq "no"
MC/DC0%0/2
$x eq "yes" or $x eq "no"
$x eq "yes"
$x eq "no"
Truth table0%0/3
A or B
A= $x eq "yes"B= $x eq "no"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | return ($x); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 56 | ▶ | if ( my $l = $ENUM{$k} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 12 | my $x = lc $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 12 | ▶ | return ( undef, 'argument(s) must be one of the following: ' . join( ', ', @$l ) ) unless grep { $_ eq $x } @$l; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 11 | return ($x); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 44 | ▶ | if ( $k =~ /\A(?:port|maxclients|databases|timeout|tcp-keepalive|tcp-backlog|maxmemory-samples|slowlog-log-slower-than|slowlog-max-len)\z/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 17 | ▶ | return ( undef, 'argument couldn\'t be parsed into an integer' ) unless $v =~ /\A-?\d+\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 17 | return ("$v"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 27 | return ($v); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 14 | ▶ | sub parse_conf { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_conf: called CC=17 SCAR=30.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 14 | my ($text) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 14 | my %v = %DEFAULT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 14 | my $n = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 14 | ▶ | for my $line ( split /\n/, $text // '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$text // ""
MC/DC100%1/1
$text // ""
$text
Truth table100%2/2
A
A= $text
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 74 | $n++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 74 | ▶ | next if $line =~ /\A\s*(?:#|\z)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 74 | my ( $k, $rest ) = $line =~ /\A\s*(\S+)\s*(.*?)\s*\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 74 | $k = lc $k; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 74 | ▶ | $k = $ALIAS{$k} // $k; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$Langertha::Holmgang::Sim::Linux::Redis::ALIAS{$k} // $k
MC/DC0%0/2
$Langertha::Holmgang::Sim::Linux::Redis::ALIAS{$k} // $k
$Langertha::Holmgang::Sim::Linux::Redis::ALIAS{$k}
$k
Truth table33%1/3
A // B
A= $Langertha::Holmgang::Sim::Linux::Redis::ALIAS{$k}B= $k
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 74 | ▶ | next if $k eq 'include' || $k eq 'rename-command' || $k eq 'unixsocket' || $k eq 'unixsocketperm'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$k eq "include" or $k eq "rename-command" or $k eq "unixsocket" or $k eq "unixsocketperm"
$k eq "include" or $k eq "rename-command" or $k eq "unixsocket"
$k eq "include" or $k eq "rename-command"
MC/DC0%0/4
$k eq "include" or $k eq "rename-command" or $k eq "unixsocket" or $k eq "unixsocketperm"
$k eq "include"
$k eq "rename-command"
$k eq "unixsocket"
$k eq "unixsocketperm"
Truth table20%1/5
A or B or C or D
A= $k eq "include"B= $k eq "rename-command"C= $k eq "unixsocket"D= $k eq "unixsocketperm"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 74 | ( my $val = $rest ) =~ s/\A"(.*)"\z/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 74 | ▶ | if ( $k eq 'replicaof' ) { $v{replicaof} = $val; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 73 | ▶ | if ( $k eq 'save' ) { $v{save} = $v{_save_seen}++ ? "$v{save} $val" : $val; $v{save} = '' if $val eq '""' || $val eq ''; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
$val eq "\"\"" or $val eq ""
MC/DC0%0/2
$val eq "\"\"" or $val eq ""
$val eq "\"\""
$val eq ""
Truth table33%1/3
A or B
A= $val eq "\"\""B= $val eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 63 | ▶ | return ( undef, $n, $line, 'Bad directive or wrong number of arguments' ) unless exists $DEFAULT{$k}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 61 | ▶ | my ( $x, $err ) = _check_value( $k, $k eq 'bind' ? $rest : $val ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 61 | ▶ | return ( undef, $n, $line, $err ) unless defined $x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 61 | $v{$k} = $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 12 | delete $v{_save_seen}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 12 | return ( \%v ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 163 | ▶ | sub _running { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_running: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 163 | my ($dev) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 163 | my $r = $dev->{redis}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 163 | ▶ | if ( !$r->{running} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 9 | ▶ | my ($v) = parse_conf( _file_text( $dev, $r->{conf} // '/etc/redis/redis.conf' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$$r{"conf"} // "/etc/redis/redis.conf"
MC/DC100%1/1
$$r{"conf"} // "/etc/redis/redis.conf"
$$r{"conf"}
Truth table100%2/2
A
A= $$r{"conf"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 9 | ▶ | $r->{running} = $v // {%DEFAULT}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$v // {%Langertha::Holmgang::Sim::Linux::Redis::DEFAULT}
MC/DC100%1/1
$v // {%Langertha::Holmgang::Sim::Linux::Redis::DEFAULT}
$v
Truth table100%2/2
A
A= $v
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 163 | return $r->{running}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 3 | ▶ | sub conf_error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
conf_error: called CC=4 SCAR=14.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 3 | my ($dev) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 3 | ▶ | my $r = $dev->{redis} or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 3 | ▶ | my ( $v, $n, $line, $why ) = parse_conf( _file_text( $dev, $r->{conf} // '/etc/redis/redis.conf' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{"conf"} // "/etc/redis/redis.conf"
MC/DC0%0/1
$$r{"conf"} // "/etc/redis/redis.conf"
$$r{"conf"}
Truth table50%1/2
A
A= $$r{"conf"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 3 | ▶ | return undef if $v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 1 | return [ '*** FATAL CONFIG FILE ERROR (Redis 7.0.15) ***', "Reading the configuration file, at line $n", ">>> '$line'", $why ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 3 | ▶ | sub service_event { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
service_event: called CC=20 SCAR=33.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 3 | my ( $dev, $verb, $state ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 3 | ▶ | my $r = $dev->{redis} or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | # beim Herunterfahren sichert Redis, wenn Sicherungspunkte gesetzt sind (scheitert es, ist der Rest weg) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 3 | ▶ | _bgsave($dev) if ( $verb eq 'restart' || $verb eq 'stop' ) && ( _running($dev)->{save} // '' ) ne ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%4/8
$verb eq "restart" || $verb eq "stop" and (_running($dev)->{"save"} // "") ne ""
$verb eq "restart" or $verb eq "stop"
_running($dev)->{"save"} // ""
MC/DC0%0/3
$verb eq "restart" || $verb eq "stop" and (_running($dev)->{"save"} // "") ne ""
$verb eq "restart"
$verb eq "stop"
_running($dev)->{"save"}
Truth table40%2/5
A or B and C
A= $verb eq "restart"B= $verb eq "stop"C= _running($dev)->{"save"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 3 | ▶ | if ( $verb eq 'start' || $verb eq 'restart' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$verb eq "start" or $verb eq "restart"
MC/DC50%1/2
$verb eq "start" or $verb eq "restart"
$verb eq "start"
$verb eq "restart"
Truth table66%2/3
A or B
A= $verb eq "start"B= $verb eq "restart"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 2 | ▶ | my ($v) = parse_conf( _file_text( $dev, $r->{conf} // '/etc/redis/redis.conf' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{"conf"} // "/etc/redis/redis.conf"
MC/DC0%0/1
$$r{"conf"} // "/etc/redis/redis.conf"
$$r{"conf"}
Truth table50%1/2
A
A= $$r{"conf"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 2 | ▶ | $r->{running} = $v if $v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | # was seit der letzten Sicherung dazukam, ist weg (RDB wird geladen); lost zaehlt es | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 2 | ▶ | if ( $r->{saved} && JSON::MaybeXS->new( canonical => 1 )->encode( $r->{saved} ) ne JSON::MaybeXS->new( canonical => 1 )->encode( $r->{keys} || {} ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$$r{"saved"} and "JSON::MaybeXS"->new("canonical", 1)->encode($$r{"saved"}) ne "JSON::MaybeXS"->new("canonical", 1)->encode($$r{"keys"} || {})
$$r{'keys'} || {}
MC/DC50%1/2
$$r{"saved"} and "JSON::MaybeXS"->new("canonical", 1)->encode($$r{"saved"}) ne "JSON::MaybeXS"->new("canonical", 1)->encode($$r{"keys"} || {})
$$r{"saved"}
"JSON::MaybeXS"->new("canonical", 1)->encode($$r{"saved"}) ne "JSON::MaybeXS"->new("canonical", 1)->encode($$r{"keys"} || {})
MC/DC0%0/1
$$r{'keys'} || {}
$$r{'keys'}
Truth table66%2/3
A and B
A= $$r{"saved"}B= "JSON::MaybeXS"->new("canonical", 1)->encode($$r{"saved"}) ne "JSON::MaybeXS"->new("canonical", 1)->encode($$r{"keys"} || {})
Truth table50%1/2
A
A= $$r{'keys'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | my $diff = _keys_total($r) - do { my $n = 0; $n += $_ for values %{ $r->{saved} }; $n }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 1 | ▶ | $r->{lost} = ( $r->{lost} // 0 ) + ( $diff > 0 ? $diff : 1 ) if $verb eq 'restart' || $diff; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition40%2/5
$verb eq "restart" or $diff
$$r{"lost"} // 0
MC/DC0%0/2
$verb eq "restart" or $diff
$verb eq "restart"
$diff
MC/DC0%0/1
$$r{"lost"} // 0
$$r{"lost"}
Truth table33%1/3
A or B
A= $verb eq "restart"B= $diff
Truth table50%1/2
A
A= $$r{"lost"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | $r->{keys} = { %{ $r->{saved} } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | delete $r->{data}; # ungesicherte Einzelwerte sind ebenso weg | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 2 | ▶ | $r->{rdb_changes} = 0 if $r->{rdb_changes}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 2 | ▶ | $r->{rdb_ok} = JSON::MaybeXS::true() unless $r->{rdb_ok}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 3 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 48 | ▶ | sub _active { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_active: called CC=5 SCAR=16.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 48 | my ($dev) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 48 | ▶ | my $svc = ( $dev->{services} || {} )->{ $dev->{redis}{service} // 'redis-server' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$$dev{'services'} || {}
$$dev{"redis"}{"service"} // "redis-server"
MC/DC0%0/1
$$dev{'services'} || {}
$$dev{'services'}
MC/DC0%0/1
$$dev{"redis"}{"service"} // "redis-server"
$$dev{"redis"}{"service"}
Truth table50%1/2
A
A= $$dev{'services'}
Truth table50%1/2
A
A= $$dev{"redis"}{"service"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 48 | ▶ | return $svc && $svc->{active} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$svc and $$svc{"active"}
MC/DC50%1/2
$svc and $$svc{"active"}
$svc
$$svc{"active"}
Truth table66%2/3
A and B
A= $svcB= $$svc{"active"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 47 | ▶ | sub _bound_to { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_bound_to: called CC=5 SCAR=17.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 47 | my ( $dev, $host ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 47 | ▶ | my $b = _running($dev)->{bind} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_running($dev)->{"bind"} // ""
MC/DC0%0/1
_running($dev)->{"bind"} // ""
_running($dev)->{"bind"}
Truth table50%1/2
A
A= _running($dev)->{"bind"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 47 | my @a = map { s/\A-//r } split /\s+/, $b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 47 | ▶ | return 1 if grep { $_ eq '0.0.0.0' || $_ eq '*' } @a; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_ eq '0.0.0.0' || $_ eq '*'
MC/DC0%0/2
$_ eq '0.0.0.0' || $_ eq '*'
$_ eq '0.0.0.0'
$_ eq '*'
Truth table33%1/3
A || B
A= $_ eq '0.0.0.0'B= $_ eq '*'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 47 | ▶ | $host = '127.0.0.1' if $host eq 'localhost'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 47 | return scalar grep { $_ eq $host } @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 18 | ▶ | sub _need_failing { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_need_failing: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 18 | my ( $dev, $needs ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 18 | ▶ | return Langertha::Holmgang::Sim::Linux::_failing_need( $dev, { needs => $needs || [] } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$needs || []
MC/DC100%1/1
$needs || []
$needs
Truth table100%2/2
A
A= $needs
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 6 | ▶ | sub _bgsave { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_bgsave: called CC=13 SCAR=26.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 6 | my ($dev) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 6 | my $r = $dev->{redis}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 6 | ▶ | my $bad = _need_failing( $dev, $r->{fork_needs} ) || _need_failing( $dev, $r->{bgsave_needs} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
_need_failing($dev, $$r{'fork_needs'}) || _need_failing($dev, $$r{'bgsave_needs'})
MC/DC50%1/2
_need_failing($dev, $$r{'fork_needs'}) || _need_failing($dev, $$r{'bgsave_needs'})
_need_failing($dev, $$r{'fork_needs'})
_need_failing($dev, $$r{'bgsave_needs'})
Truth table66%2/3
A || B
A= _need_failing($dev, $$r{'fork_needs'})B= _need_failing($dev, $$r{'bgsave_needs'})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 6 | ▶ | if ($bad) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 3 | ▶ | $r->{rdb_ok} = JSON::MaybeXS::false() if $r->{rdb_ok} // 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$$r{"rdb_ok"} // 1
MC/DC100%1/1
$$r{"rdb_ok"} // 1
$$r{"rdb_ok"}
Truth table100%2/2
A
A= $$r{"rdb_ok"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 3 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 3 | ▶ | $r->{rdb_ok} = JSON::MaybeXS::true() unless $r->{rdb_ok}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 3 | ▶ | $r->{saved} = { %{ $r->{keys} || {} } }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'keys'} || {}
MC/DC0%0/1
$$r{'keys'} || {}
$$r{'keys'}
Truth table50%1/2
A
A= $$r{'keys'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # die Sicherung schreibt dir/dbfilename neu (temp-Datei, dann umbenannt: redis:redis 0660, neue Zeit) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 3 | my $run = _running($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 3 | ▶ | ( my $dir = $run->{dir} // '/var/lib/redis' ) =~ s{/+\z}{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$run{"dir"} // "/var/lib/redis"
MC/DC0%0/1
$$run{"dir"} // "/var/lib/redis"
$$run{"dir"}
Truth table50%1/2
A
A= $$run{"dir"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 3 | ▶ | my $p = "$dir/" . ( $run->{dbfilename} // 'dump.rdb' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$run{"dbfilename"} // "dump.rdb"
MC/DC0%0/1
$$run{"dbfilename"} // "dump.rdb"
$$run{"dbfilename"}
Truth table50%1/2
A
A= $$run{"dbfilename"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 3 | ▶ | my $old = ref $dev->{files}{$p} eq 'HASH' ? $dev->{files}{$p} : {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 3 | ▶ | $dev->{files}{$p} = { content => '', size => $old->{size} // '1M', owner => 'redis', group => 'redis', mode => '0660', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$old{"size"} // "1M"
MC/DC0%0/1
$$old{"size"} // "1M"
$$old{"size"}
Truth table50%1/2
A
A= $$old{"size"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | mtime => Langertha::Holmgang::Sim::Linux::_clock($dev) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 3 | ▶ | $r->{rdb_changes} = 0 if $r->{rdb_changes}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 3 | ▶ | $r->{lastsave} = ( $r->{lastsave} // 1792821600 ) + 60; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{"lastsave"} // 1792821600
MC/DC0%0/1
$$r{"lastsave"} // 1792821600
$$r{"lastsave"}
Truth table50%1/2
A
A= $$r{"lastsave"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 3 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 1 | ▶ | sub _keys_total { my ($r) = @_; my $n = 0; $n += $_ for values %{ $r->{keys} || {} }; return $n } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_keys_total: called CC=3 SCAR=11.1
Condition50%1/2
$$r{'keys'} || {}
MC/DC0%0/1
$$r{'keys'} || {}
$$r{'keys'}
Truth table50%1/2
A
A= $$r{'keys'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 6 | ▶ | sub _info { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_info: called CC=33 SCAR=41.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 6 | my ( $dev, $sec ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 6 | my $r = $dev->{redis}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 6 | my $run = _running($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 6 | ▶ | my $used = $r->{used_memory} // 1048576; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$$r{"used_memory"} // 1048576
MC/DC100%1/1
$$r{"used_memory"} // 1048576
$$r{"used_memory"}
Truth table100%2/2
A
A= $$r{"used_memory"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 6 | ▶ | my $max = $run->{maxmemory} // 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$run{"maxmemory"} // 0
MC/DC0%0/1
$$run{"maxmemory"} // 0
$$run{"maxmemory"}
Truth table50%1/2
A
A= $$run{"maxmemory"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 6 | my %s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | $s{server} = [ 'redis_version:7.0.15', 'redis_mode:standalone', 'os:Linux 6.1.0-26-amd64 x86_64', 'process_id:' . ( $r->{pid} // 811 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | "tcp_port:$run->{port}", 'uptime_in_seconds:' . ( $r->{uptime} // 1728000 ), 'uptime_in_days:' . int( ( $r->{uptime} // 1728000 ) / 86400 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 6 | ▶ | 'executable:/usr/bin/redis-server', 'config_file:' . ( $r->{conf} // '/etc/redis/redis.conf' ) ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%4/8
$$r{"pid"} // 811
$$r{"uptime"} // 1728000
$$r{"uptime"} // 1728000
$$r{"conf"} // "/etc/redis/redis.conf"
MC/DC0%0/1
$$r{"pid"} // 811
$$r{"pid"}
MC/DC0%0/1
$$r{"uptime"} // 1728000
$$r{"uptime"}
MC/DC0%0/1
$$r{"uptime"} // 1728000
$$r{"uptime"}
MC/DC0%0/1
$$r{"conf"} // "/etc/redis/redis.conf"
$$r{"conf"}
Truth table50%1/2
A
A= $$r{"pid"}
Truth table50%1/2
A
A= $$r{"uptime"}
Truth table50%1/2
A
A= $$r{"uptime"}
Truth table50%1/2
A
A= $$r{"conf"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 6 | ▶ | $s{clients} = [ 'connected_clients:' . ( $r->{clients} // 3 ), 'maxclients:' . ( $r->{effective_maxclients} // $run->{maxclients} ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition40%2/5
$$r{"clients"} // 3
$$r{"effective_maxclients"} // $$run{"maxclients"}
MC/DC0%0/1
$$r{"clients"} // 3
$$r{"clients"}
MC/DC0%0/2
$$r{"effective_maxclients"} // $$run{"maxclients"}
$$r{"effective_maxclients"}
$$run{"maxclients"}
Truth table50%1/2
A
A= $$r{"clients"}
Truth table33%1/3
A // B
A= $$r{"effective_maxclients"}B= $$run{"maxclients"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 'blocked_clients:0' ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | $s{memory} = [ "used_memory:$used", 'used_memory_human:' . _info_human($used), 'used_memory_rss:' . int( $used * 1.08 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 6 | ▶ | 'used_memory_peak:' . ( $r->{used_memory_peak} // $used ), "maxmemory:$max", 'maxmemory_human:' . _info_human($max), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$$r{"used_memory_peak"} // $used
MC/DC0%0/2
$$r{"used_memory_peak"} // $used
$$r{"used_memory_peak"}
$used
Truth table33%1/3
A // B
A= $$r{"used_memory_peak"}B= $used
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | "maxmemory_policy:$run->{'maxmemory-policy'}", 'mem_fragmentation_ratio:1.08', 'mem_allocator:jemalloc-5.3.0' ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | $s{persistence} = [ 'loading:0', 'rdb_changes_since_last_save:' . ( $r->{rdb_changes} // 0 ), 'rdb_bgsave_in_progress:0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 'rdb_last_save_time:' . ( $r->{lastsave} // 1792821600 ), 'rdb_last_bgsave_status:' . ( ( $r->{rdb_ok} // 1 ) ? 'ok' : 'err' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 6 | ▶ | 'rdb_last_bgsave_time_sec:' . ( ( $r->{rdb_ok} // 1 ) ? 2 : -1 ), 'aof_enabled:' . ( $run->{appendonly} eq 'yes' ? 1 : 0 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%8/8
$$r{"rdb_changes"} // 0
$$r{"lastsave"} // 1792821600
$$r{"rdb_ok"} // 1
$$r{"rdb_ok"} // 1
MC/DC100%1/1
$$r{"rdb_changes"} // 0
$$r{"rdb_changes"}
MC/DC100%1/1
$$r{"lastsave"} // 1792821600
$$r{"lastsave"}
MC/DC100%1/1
$$r{"rdb_ok"} // 1
$$r{"rdb_ok"}
MC/DC100%1/1
$$r{"rdb_ok"} // 1
$$r{"rdb_ok"}
Truth table100%2/2
A
A= $$r{"rdb_changes"}
Truth table100%2/2
A
A= $$r{"lastsave"}
Truth table100%2/2
A
A= $$r{"rdb_ok"}
Truth table100%2/2
A
A= $$r{"rdb_ok"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 'aof_last_write_status:ok' ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 6 | ▶ | my $st = $r->{stats} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'stats'} || {}
MC/DC0%0/1
$$r{'stats'} || {}
$$r{'stats'}
Truth table50%1/2
A
A= $$r{'stats'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | $s{stats} = [ 'total_connections_received:' . ( $st->{total_connections_received} // 912233 ), 'rejected_connections:' . ( $st->{rejected_connections} // 0 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 'expired_keys:' . ( $st->{expired_keys} // 0 ), 'evicted_keys:' . ( $st->{evicted_keys} // 0 ), 'keyspace_hits:' . ( $st->{keyspace_hits} // 1200443 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 6 | ▶ | 'keyspace_misses:' . ( $st->{keyspace_misses} // 80211 ) ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%6/12
$$st{"total_connections_received"} // 912233
$$st{"rejected_connections"} // 0
$$st{"expired_keys"} // 0
$$st{"evicted_keys"} // 0
$$st{"keyspace_hits"} // 1200443
$$st{"keyspace_misses"} // 80211
MC/DC0%0/1
$$st{"total_connections_received"} // 912233
$$st{"total_connections_received"}
MC/DC0%0/1
$$st{"rejected_connections"} // 0
$$st{"rejected_connections"}
MC/DC0%0/1
$$st{"expired_keys"} // 0
$$st{"expired_keys"}
MC/DC0%0/1
$$st{"evicted_keys"} // 0
$$st{"evicted_keys"}
MC/DC0%0/1
$$st{"keyspace_hits"} // 1200443
$$st{"keyspace_hits"}
MC/DC0%0/1
$$st{"keyspace_misses"} // 80211
$$st{"keyspace_misses"}
Truth table50%1/2
A
A= $$st{"total_connections_received"}
Truth table50%1/2
A
A= $$st{"rejected_connections"}
Truth table50%1/2
A
A= $$st{"expired_keys"}
Truth table50%1/2
A
A= $$st{"evicted_keys"}
Truth table50%1/2
A
A= $$st{"keyspace_hits"}
Truth table50%1/2
A
A= $$st{"keyspace_misses"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 6 | ▶ | if ( my $p = _replica_of( $dev ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 2 | my $up = _link_up( $dev, $p ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 2 | ▶ | $s{replication} = [ 'role:slave', "master_host:$p->{host}", "master_port:$p->{port}", 'master_link_status:' . ( $up ? 'up' : 'down' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 'master_last_io_seconds_ago:' . ( $up ? 1 : -1 ), 'master_sync_in_progress:0', 'slave_read_only:1', 'connected_slaves:0' ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 4 | ▶ | else { $s{replication} = [ 'role:master', 'connected_slaves:' . ( $r->{connected_slaves} // 0 ), 'master_repl_offset:' . ( $r->{repl_offset} // 0 ) ] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$$r{"connected_slaves"} // 0
$$r{"repl_offset"} // 0
MC/DC0%0/1
$$r{"connected_slaves"} // 0
$$r{"connected_slaves"}
MC/DC0%0/1
$$r{"repl_offset"} // 0
$$r{"repl_offset"}
Truth table50%1/2
A
A= $$r{"connected_slaves"}
Truth table50%1/2
A
A= $$r{"repl_offset"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 6 | $s{cpu} = [ 'used_cpu_sys:812.441201', 'used_cpu_user:1503.120044' ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 6 | ▶ | $s{keyspace} = [ map { "$_:keys=$r->{keys}{$_},expires=0,avg_ttl=0" } grep { $r->{keys}{$_} } sort keys %{ $r->{keys} || {} } ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{'keys'} || {}
MC/DC0%0/1
$$r{'keys'} || {}
$$r{'keys'}
Truth table50%1/2
A
A= $$r{'keys'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 6 | my @order = qw( server clients memory persistence stats replication cpu keyspace ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 6 | ▶ | my @want = !defined $sec || $sec eq '' || $sec =~ /\A(?:all|everything|default)\z/i ? @order : grep { $_ eq lc $sec } @order; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not defined $sec or $sec eq "" or $sec =~ /\A(?:all|everything|default)\z/i
not defined $sec or $sec eq ""
MC/DC0%0/3
not defined $sec or $sec eq "" or $sec =~ /\A(?:all|everything|default)\z/i
not defined $sec
$sec eq ""
$sec =~ /\A(?:all|everything|default)\z/i
Truth table25%1/4
not(A) or B or C
A= not defined $secB= $sec eq ""C= $sec =~ /\A(?:all|everything|default)\z/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 6 | return join "\n", map { ( '# ' . ucfirst($_), @{ $s{$_} }, '' ) } @want; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | # Replikat: { host, port, primary } aus dem laufenden replicaof | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 9 | ▶ | sub _replica_of { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_replica_of: called CC=9 SCAR=24.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 9 | my ($dev) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 9 | ▶ | my $ro = _running($dev)->{replicaof} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
_running($dev)->{"replicaof"} // ""
MC/DC100%1/1
_running($dev)->{"replicaof"} // ""
_running($dev)->{"replicaof"}
Truth table100%2/2
A
A= _running($dev)->{"replicaof"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 9 | ▶ | return undef unless $ro =~ /\A(\S+)\s+(\d+)\z/ && lc $1 ne 'no'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$ro =~ /\A(\S+)\s+(\d+)\z/ and lc $1 ne "no"
MC/DC50%1/2
$ro =~ /\A(\S+)\s+(\d+)\z/ and lc $1 ne "no"
$ro =~ /\A(\S+)\s+(\d+)\z/
lc $1 ne "no"
Truth table66%2/3
A and B
A= $ro =~ /\A(\S+)\s+(\d+)\z/B= lc $1 ne "no"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 3 | my ( $host, $port ) = ( $1, $2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # Primaer: das Geraet mit dieser Adresse (auch nach einer Umschaltung), sonst replica.primary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 3 | ▶ | my $state = $Langertha::Holmgang::Sim::Linux::CTX ? $Langertha::Holmgang::Sim::Linux::CTX->{state} : {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 3 | ▶ | my ($by_addr) = grep { ref $state->{$_} eq 'HASH' && $state->{$_}{redis} && grep { $_ eq $host } _addrs( $state->{$_} ) } sort keys %$state; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
ref $$state{$_} eq 'HASH' && $$state{$_}{'redis'} && grep({$_ eq $host;} _addrs($$state{$_}))
ref $$state{$_} eq "HASH" and $$state{$_}{"redis"}
MC/DC33%1/3
ref $$state{$_} eq 'HASH' && $$state{$_}{'redis'} && grep({$_ eq $host;} _addrs($$state{$_}))
ref $$state{$_} eq "HASH"
$$state{$_}{"redis"}
grep({$_ eq $host;} _addrs($$state{$_}))
Truth table50%2/4
A and B && C
A= ref $$state{$_} eq "HASH"B= $$state{$_}{"redis"}C= grep({$_ eq $host;} _addrs($$state{$_}))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 3 | ▶ | return { host => $host, port => $port, primary => $by_addr // ( $dev->{redis}{replica} || {} )->{primary} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition20%1/5
$by_addr // ($$dev{"redis"}{"replica"} || {})->{"primary"}
$$dev{'redis'}{'replica'} || {}
MC/DC0%0/2
$by_addr // ($$dev{"redis"}{"replica"} || {})->{"primary"}
$by_addr
$$dev{'redis'}{'replica'}
Truth table33%1/3
A // B
A= $by_addrB= $$dev{'redis'}{'replica'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 6 | ▶ | sub _addrs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_addrs: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 6 | my ($dev) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 6 | ▶ | return map { s{/\d+\z}{}r } map { @{ $_->{addr} || [] } } grep { ref eq 'HASH' } values %{ $dev->{interfaces} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$$_{'addr'} || []
$$dev{'interfaces'} || {}
MC/DC0%0/1
$$_{'addr'} || []
$$_{'addr'}
MC/DC0%0/1
$$dev{'interfaces'} || {}
$$dev{'interfaces'}
Truth table50%1/2
A
A= $$_{'addr'}
Truth table50%1/2
A
A= $$dev{'interfaces'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | # Verbindung zum Primaer steht, wenn es ihn gibt, er laeuft und masterauth zu seinem requirepass passt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 2 | ▶ | sub _link_up { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_link_up: called CC=13 SCAR=35.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 2 | my ( $dev, $p ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 2 | ▶ | my $state = $Langertha::Holmgang::Sim::Linux::CTX ? $Langertha::Holmgang::Sim::Linux::CTX->{state} : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 2 | ▶ | my $pd = $state && defined $p->{primary} ? $state->{ $p->{primary} } : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$state and defined $$p{"primary"}
MC/DC0%0/2
$state and defined $$p{"primary"}
$state
defined $$p{"primary"}
Truth table33%1/3
A and B
A= $stateB= defined $$p{"primary"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 2 | ▶ | return 0 unless $pd && $pd->{redis} && _active($pd); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$pd and $$pd{"redis"} and _active($pd)
$pd and $$pd{"redis"}
MC/DC0%0/3
$pd and $$pd{"redis"} and _active($pd)
$pd
$$pd{"redis"}
_active($pd)
Truth table25%1/4
A and B and C
A= $pdB= $$pd{"redis"}C= _active($pd)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 2 | my $prun = _running($pd); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 2 | ▶ | return 0 unless _bound_to( $pd, $p->{host} ) && $prun->{port} eq $p->{port}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
_bound_to($pd, $$p{"host"}) and $$prun{"port"} eq $$p{"port"}
MC/DC0%0/2
_bound_to($pd, $$p{"host"}) and $$prun{"port"} eq $$p{"port"}
_bound_to($pd, $$p{"host"})
$$prun{"port"} eq $$p{"port"}
Truth table33%1/3
A and B
A= _bound_to($pd, $$p{"host"})B= $$prun{"port"} eq $$p{"port"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 2 | ▶ | return ( $prun->{requirepass} // '' ) eq '' || ( _running($dev)->{masterauth} // '' ) eq $prun->{requirepass} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition28%2/7
($$prun{"requirepass"} // "") eq "" or (_running($dev)->{"masterauth"} // "") eq $$prun{"requirepass"}
$$prun{"requirepass"} // ""
_running($dev)->{"masterauth"} // ""
MC/DC0%0/2
($$prun{"requirepass"} // "") eq "" or (_running($dev)->{"masterauth"} // "") eq $$prun{"requirepass"}
$$prun{"requirepass"}
_running($dev)->{"masterauth"}
Truth table33%1/3
A or B
A= $$prun{"requirepass"}B= _running($dev)->{"masterauth"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 2 | ▶ | sub _glob_re { my ($g) = @_; ( my $re = quotemeta $g ) =~ s/\\\*/.*/g; $re =~ s/\\\?/./g; return qr/\A$re\z/i } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_glob_re: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 2 | ▶ | sub _fmt_bulk_list { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fmt_bulk_list: called CC=4 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 2 | my ( $raw, @v ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 2 | ▶ | return '(empty array)' if !@v && !$raw; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@v or $raw
MC/DC0%0/2
@v or $raw
@v
$raw
Truth table33%1/3
A or B
A= @vB= $raw
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 2 | ▶ | return join "\n", @v if $raw; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 1 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 1 | return join "\n", map { $i++; sprintf( '%d) "%s"', $i, $_ ) } @v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 1 | ▶ | sub _rewrite { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_rewrite: called CC=23 SCAR=40.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 1 | my ($dev) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 1 | my $r = $dev->{redis}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 1 | ▶ | my $conf = $r->{conf} // '/etc/redis/redis.conf'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{"conf"} // "/etc/redis/redis.conf"
MC/DC0%0/1
$$r{"conf"} // "/etc/redis/redis.conf"
$$r{"conf"}
Truth table50%1/2
A
A= $$r{"conf"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 1 | my $text = _file_text( $dev, $conf ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 1 | ▶ | return 0 unless defined $text; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 1 | my $run = _running($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 1 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 6 | ▶ | my $fmt = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=19.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 6 | my ($k) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 6 | ▶ | my $v = $run->{$k} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$run{$k} // ""
MC/DC0%0/1
$$run{$k} // ""
$$run{$k}
Truth table50%1/2
A
A= $$run{$k}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 6 | ▶ | $v = _human_bytes($v) if $BYTES{$k}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 6 | ▶ | return $k eq 'save' && $v eq '' ? qq{save ""} : $v eq '' ? qq{$k ""} : "$k $v"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$k eq "save" and $v eq ""
MC/DC0%0/2
$k eq "save" and $v eq ""
$k eq "save"
$v eq ""
Truth table66%2/3
A and B
A= $k eq "save"B= $v eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 1 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 1 | for my $line ( split /\n/, $text ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 6 | my ($k) = $line =~ /\A\s*([A-Za-z][\w-]*)\s/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 6 | ▶ | $k = $ALIAS{ lc( $k // '' ) } // lc( $k // '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
$Langertha::Holmgang::Sim::Linux::Redis::ALIAS{lc($k // "")} // lc($k // "")
$k // ""
$k // ""
MC/DC0%0/1
$Langertha::Holmgang::Sim::Linux::Redis::ALIAS{lc($k // "")} // lc($k // "")
$Langertha::Holmgang::Sim::Linux::Redis::ALIAS{lc($k // "")}
Truth table50%1/2
A
A= $Langertha::Holmgang::Sim::Linux::Redis::ALIAS{lc($k // "")}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 6 | ▶ | if ( length $k && ( exists $DEFAULT{$k} || $k eq 'replicaof' ) && $line !~ /\A\s*#/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
length $k and exists $Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$k} || $k eq "replicaof" and not $line =~ /\A\s*#/
length $k and exists $Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$k} || $k eq "replicaof"
exists $Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$k} or $k eq "replicaof"
MC/DC0%0/4
length $k and exists $Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$k} || $k eq "replicaof" and not $line =~ /\A\s*#/
length $k
exists $Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$k}
$k eq "replicaof"
not $line =~ /\A\s*#/
Truth table16%1/6
A and B or C and not(D)
A= length $kB= exists $Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$k}C= $k eq "replicaof"D= not $line =~ /\A\s*#/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 6 | ▶ | next if $seen{$k}++; # doppelte Zeilen (save) fasst REWRITE zusammen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 6 | ▶ | push @out, $k eq 'replicaof' && !( $run->{replicaof} // '' ) ? () : $fmt->($k); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$k eq "replicaof" and not $$run{"replicaof"} // ""
$$run{"replicaof"} // ""
MC/DC0%0/2
$k eq "replicaof" and not $$run{"replicaof"} // ""
$k eq "replicaof"
$$run{"replicaof"}
Truth table33%1/3
A and not(B)
A= $k eq "replicaof"B= $$run{"replicaof"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 6 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | push @out, $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 1 | ▶ | my @new = grep { !$seen{$_} && ( $run->{$_} // '' ) ne ( $DEFAULT{$_} // '' ) } sort keys %DEFAULT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition57%4/7
!$seen{$_} && ($$run{$_} // '') ne ($Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$_} // '')
$$run{$_} // ""
$Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$_} // ""
MC/DC50%1/2
!$seen{$_} && ($$run{$_} // '') ne ($Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$_} // '')
!$seen{$_}
$$run{$_}
MC/DC0%0/1
$Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$_} // ""
$Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$_}
Truth table66%2/3
not(A) && B
A= !$seen{$_}B= $$run{$_}
Truth table50%1/2
A
A= $Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 1 | ▶ | push @new, 'replicaof' if !$seen{replicaof} && ( $run->{replicaof} // '' ) ne ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
not $seen{"replicaof"} and ($$run{"replicaof"} // "") ne ""
$$run{"replicaof"} // ""
MC/DC0%0/2
not $seen{"replicaof"} and ($$run{"replicaof"} // "") ne ""
not $seen{"replicaof"}
$$run{"replicaof"}
Truth table33%1/3
not(A) and B
A= not $seen{"replicaof"}B= $$run{"replicaof"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 1 | ▶ | if (@new) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | push @out, '# Generated by CONFIG REWRITE' unless grep { $_ eq '# Generated by CONFIG REWRITE' } @out; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | push @out, map { $fmt->($_) } @new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 1 | _set_file( $dev, $conf, join( "\n", @out ) . "\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 7 | ▶ | sub _err { my ($m) = @_; return ( "(error) $m", 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_err: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | # Ein Befehl (Woerter) -> ( ausgabe, ok ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 45 | ▶ | sub _command { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_command: called CC=174 SCAR=78.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 45 | my ( $dev, $w, $o ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 45 | my $r = $dev->{redis}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 45 | my $run = _running($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 45 | my @w = @$w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 45 | ▶ | my $cmd = uc( shift(@w) // '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift @w // ""
MC/DC0%0/1
shift @w // ""
shift @w
Truth table50%1/2
A
A= shift @w
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 45 | my $raw = $o->{raw}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 45 | ▶ | if ( $cmd eq 'AUTH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | my $pw = pop @w // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
pop @w // ""
MC/DC0%0/1
pop @w // ""
pop @w
Truth table0%0/2
A
A= pop @w
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | return _err('ERR AUTH <password> called without any password configured for the default user. Are you sure your configuration is correct?') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | if ( $run->{requirepass} // '' ) eq ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$run{"requirepass"} // ""
MC/DC0%0/1
$$run{"requirepass"} // ""
$$run{"requirepass"}
Truth table0%0/2
A
A= $$run{"requirepass"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | return _err('WRONGPASS invalid username-password pair or user is disabled.') unless $pw eq $run->{requirepass}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $o->{authed} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | return ( 'OK', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 45 | ▶ | return _err('NOAUTH Authentication required.') if ( $run->{requirepass} // '' ) ne '' && !$o->{authed}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition80%4/5
($$run{"requirepass"} // "") ne "" and not $$o{"authed"}
$$run{"requirepass"} // ""
MC/DC50%1/2
($$run{"requirepass"} // "") ne "" and not $$o{"authed"}
$$run{"requirepass"}
not $$o{"authed"}
Truth table66%2/3
A and not(B)
A= $$run{"requirepass"}B= not $$o{"authed"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 44 | ▶ | return ( 'PONG', 1 ) if $cmd eq 'PING' && !@w; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$cmd eq "PING" and not @w
MC/DC50%1/2
$cmd eq "PING" and not @w
$cmd eq "PING"
not @w
Truth table66%2/3
A and not(B)
A= $cmd eq "PING"B= not @w
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 41 | ▶ | return ( $w[0], 1 ) if $cmd eq 'PING'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 41 | ▶ | if ( $cmd eq 'INFO' ) { return ( _info( $dev, $w[0] ), 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 35 | ▶ | if ( $cmd eq 'DBSIZE' ) { my $db = $o->{db} // 0; return ( ( $raw ? '' : '(integer) ' ) . ( $r->{keys}{"db$db"} // 0 ), 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%2/4
$$o{"db"} // 0
$$r{"keys"}{"db$db"} // 0
MC/DC0%0/1
$$o{"db"} // 0
$$o{"db"}
MC/DC0%0/1
$$r{"keys"}{"db$db"} // 0
$$r{"keys"}{"db$db"}
Truth table50%1/2
A
A= $$o{"db"}
Truth table50%1/2
A
A= $$r{"keys"}{"db$db"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | if ( $cmd eq 'LASTSAVE' ) { return ( ( $raw ? '' : '(integer) ' ) . ( $r->{lastsave} // 1792821600 ), 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/2
$$r{"lastsave"} // 1792821600
MC/DC0%0/1
$$r{"lastsave"} // 1792821600
$$r{"lastsave"}
Truth table0%0/2
A
A= $$r{"lastsave"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 34 | ▶ | if ( $cmd eq 'BGSAVE' || $cmd eq 'SAVE' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$cmd eq "BGSAVE" or $cmd eq "SAVE"
MC/DC50%1/2
$cmd eq "BGSAVE" or $cmd eq "SAVE"
$cmd eq "BGSAVE"
$cmd eq "SAVE"
Truth table66%2/3
A or B
A= $cmd eq "BGSAVE"B= $cmd eq "SAVE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | # fork scheitert: sofort ERR; Schreiben scheitert (Rechte, Platz): erst im Kind | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 2 | my $fork_bad = _need_failing( $dev, $r->{fork_needs} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 2 | my $ok = _bgsave($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 2 | ▶ | return _err('ERR') if $fork_bad || ( $cmd eq 'SAVE' && !$ok ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$fork_bad or $cmd eq "SAVE" and not $ok
$cmd eq "SAVE" and not $ok
MC/DC0%0/3
$fork_bad or $cmd eq "SAVE" and not $ok
$fork_bad
$cmd eq "SAVE"
not $ok
Truth table25%1/4
A or B and not(C)
A= $fork_badB= $cmd eq "SAVE"C= not $ok
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 2 | ▶ | return ( $cmd eq 'SAVE' ? 'OK' : 'Background saving started', 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 32 | ▶ | if ( $cmd eq 'ROLE' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | my $p = _replica_of($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | return ( _fmt_bulk_list( $raw, 'slave', $p->{host}, $p->{port}, _link_up( $dev, $p ) ? 'connected' : 'connect' ), 1 ) if $p; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | return ( _fmt_bulk_list( $raw, 'master', $r->{repl_offset} // 0 ), 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$r{"repl_offset"} // 0
MC/DC0%0/1
$$r{"repl_offset"} // 0
$$r{"repl_offset"}
Truth table0%0/2
A
A= $$r{"repl_offset"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 32 | ▶ | if ( $cmd eq 'REPLICAOF' || $cmd eq 'SLAVEOF' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$cmd eq "REPLICAOF" or $cmd eq "SLAVEOF"
MC/DC50%1/2
$cmd eq "REPLICAOF" or $cmd eq "SLAVEOF"
$cmd eq "REPLICAOF"
$cmd eq "SLAVEOF"
Truth table66%2/3
A or B
A= $cmd eq "REPLICAOF"B= $cmd eq "SLAVEOF"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 2 | ▶ | return _err("ERR wrong number of arguments for '" . lc($cmd) . "' command") unless @w == 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 2 | ▶ | if ( uc $w[0] eq 'NO' && uc $w[1] eq 'ONE' ) { $run->{replicaof} = ''; return ( 'OK', 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
uc $w[0] eq "NO" and uc $w[1] eq "ONE"
MC/DC50%1/2
uc $w[0] eq "NO" and uc $w[1] eq "ONE"
uc $w[0] eq "NO"
uc $w[1] eq "ONE"
Truth table66%2/3
A and B
A= uc $w[0] eq "NO"B= uc $w[1] eq "ONE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 1 | ▶ | return _err('ERR value is out of range, must be positive') unless $w[1] =~ /\A\d+\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 1 | $run->{replicaof} = "$w[0] $w[1]"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 1 | return ( 'OK', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | if ( $cmd eq 'ACL' && uc( $w[0] // '' ) eq 'WHOAMI' ) { return ( $raw ? 'default' : '"default"', 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition20%1/5
$cmd eq "ACL" and uc($w[0] // "") eq "WHOAMI"
$w[0] // ""
MC/DC0%0/2
$cmd eq "ACL" and uc($w[0] // "") eq "WHOAMI"
$cmd eq "ACL"
$w[0]
Truth table33%1/3
A and B
A= $cmd eq "ACL"B= $w[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 30 | ▶ | if ( $cmd eq 'CLIENT' && uc( $w[0] // '' ) eq 'LIST' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition20%1/5
$cmd eq "CLIENT" and uc($w[0] // "") eq "LIST"
$w[0] // ""
MC/DC0%0/2
$cmd eq "CLIENT" and uc($w[0] // "") eq "LIST"
$cmd eq "CLIENT"
$w[0]
Truth table33%1/3
A and B
A= $cmd eq "CLIENT"B= $w[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | ▶ | my $n = $r->{clients} // 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$r{"clients"} // 3
MC/DC0%0/1
$$r{"clients"} // 3
$$r{"clients"}
Truth table0%0/2
A
A= $$r{"clients"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | my @l = map { "id=$_ addr=" . ( $r->{client_addr} // '10.20.0.21' ) . ':' . ( 40000 + $_ ) . " laddr=127.0.0.1:6379 fd=" . ( 8 + $_ ) . " name= age=812 idle=0 flags=N db=0 cmd=get user=default" } 1 .. ( $n > 5 ? 5 : $n ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$r{"client_addr"} // "10.20.0.21"
MC/DC0%0/1
$$r{"client_addr"} // "10.20.0.21"
$$r{"client_addr"}
Truth table0%0/2
A
A= $$r{"client_addr"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | return ( join( "\n", @l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | if ( $cmd eq 'FLUSHALL' ) { $r->{flushed} = ( $r->{flushed} // 0 ) + _keys_total($r); $r->{keys} = {}; return ( 'OK', 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$$r{"flushed"} // 0
MC/DC0%0/1
$$r{"flushed"} // 0
$$r{"flushed"}
Truth table0%0/2
A
A= $$r{"flushed"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | if ( $cmd eq 'FLUSHDB' ) { $r->{flushed} = ( $r->{flushed} // 0 ) + ( $r->{keys}{ 'db' . ( $o->{db} // 0 ) } // 0 ); delete $r->{keys}{ 'db' . ( $o->{db} // 0 ) }; return ( 'OK', 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/8
$$r{"flushed"} // 0
$$r{"keys"}{'db' . ($$o{"db"} // 0)} // 0
$$o{"db"} // 0
$$o{"db"} // 0
MC/DC0%0/1
$$r{"flushed"} // 0
$$r{"flushed"}
MC/DC0%0/1
$$r{"keys"}{'db' . ($$o{"db"} // 0)} // 0
$$r{"keys"}{'db' . ($$o{"db"} // 0)}
MC/DC0%0/1
$$o{"db"} // 0
$$o{"db"}
MC/DC0%0/1
$$o{"db"} // 0
$$o{"db"}
Truth table0%0/2
A
A= $$r{"flushed"}
Truth table0%0/2
A
A= $$r{"keys"}{'db' . ($$o{"db"} // 0)}
Truth table0%0/2
A
A= $$o{"db"}
Truth table0%0/2
A
A= $$o{"db"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | # Daten: SET/GET/DEL/EXISTS/INCR/EXPIRE/TTL an einem kleinen Bestand (data); Schreiben ist bei | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | # gescheiterter Sicherung gesperrt (MISCONF), bei voller Grenze ohne Verdraengung (OOM) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 30 | ▶ | if ( $cmd =~ /\A(?:SET|SETEX|DEL|INCR|EXPIRE|HSET|LPUSH|RPUSH)\z/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 3 | ▶ | return _err("ERR wrong number of arguments for '" . lc($cmd) . "' command") unless @w; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | return _err("READONLY You can't write against a read only replica.") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 3 | ▶ | if _replica_of($dev) && ( $run->{'replica-read-only'} // 'yes' ) eq 'yes'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
_replica_of($dev) and ($$run{"replica-read-only"} // "yes") eq "yes"
$$run{"replica-read-only"} // "yes"
MC/DC50%1/2
_replica_of($dev) and ($$run{"replica-read-only"} // "yes") eq "yes"
_replica_of($dev)
$$run{"replica-read-only"}
Truth table66%2/3
A and B
A= _replica_of($dev)B= $$run{"replica-read-only"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 2 | ▶ | if ( !( $r->{rdb_ok} // 1 ) && ( $run->{'stop-writes-on-bgsave-error'} // 'yes' ) eq 'yes' && ( $run->{save} // '' ) ne '' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition58%7/12
not $$r{"rdb_ok"} // 1 and ($$run{"stop-writes-on-bgsave-error"} // "yes") eq "yes" and ($$run{"save"} // "") ne ""
not $$r{"rdb_ok"} // 1 and ($$run{"stop-writes-on-bgsave-error"} // "yes") eq "yes"
$$r{"rdb_ok"} // 1
$$run{"stop-writes-on-bgsave-error"} // "yes"
$$run{"save"} // ""
MC/DC0%0/3
not $$r{"rdb_ok"} // 1 and ($$run{"stop-writes-on-bgsave-error"} // "yes") eq "yes" and ($$run{"save"} // "") ne ""
$$r{"rdb_ok"}
$$run{"stop-writes-on-bgsave-error"}
$$run{"save"}
Truth table25%1/4
not(A) and B and C
A= $$r{"rdb_ok"}B= $$run{"stop-writes-on-bgsave-error"}C= $$run{"save"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 1 | return _err('MISCONF Redis is configured to save RDB snapshots, but it\'s currently unable to persist to disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 1 | ▶ | if ( ( $run->{maxmemory} // 0 ) > 0 && ( $r->{used_memory} // 0 ) >= $run->{maxmemory} && $run->{'maxmemory-policy'} eq 'noeviction' && $cmd ne 'DEL' && $cmd ne 'EXPIRE' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition37%6/16
($$run{"maxmemory"} // 0) > 0 and ($$r{"used_memory"} // 0) >= $$run{"maxmemory"} and $$run{"maxmemory-policy"} eq "noeviction" and $cmd ne "DEL" and $cmd ne "EXPIRE"
($$run{"maxmemory"} // 0) > 0 and ($$r{"used_memory"} // 0) >= $$run{"maxmemory"} and $$run{"maxmemory-policy"} eq "noeviction" and $cmd ne "DEL"
($$run{"maxmemory"} // 0) > 0 and ($$r{"used_memory"} // 0) >= $$run{"maxmemory"} and $$run{"maxmemory-policy"} eq "noeviction"
($$run{"maxmemory"} // 0) > 0 and ($$r{"used_memory"} // 0) >= $$run{"maxmemory"}
$$run{"maxmemory"} // 0
$$r{"used_memory"} // 0
MC/DC0%0/5
($$run{"maxmemory"} // 0) > 0 and ($$r{"used_memory"} // 0) >= $$run{"maxmemory"} and $$run{"maxmemory-policy"} eq "noeviction" and $cmd ne "DEL" and $cmd ne "EXPIRE"
$$run{"maxmemory"}
$$r{"used_memory"}
$$run{"maxmemory-policy"} eq "noeviction"
$cmd ne "DEL"
$cmd ne "EXPIRE"
Truth table0%0/6
A and B and C and D and E
A= $$run{"maxmemory"}B= $$r{"used_memory"}C= $$run{"maxmemory-policy"} eq "noeviction"D= $cmd ne "DEL"E= $cmd ne "EXPIRE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | return _err("OOM command not allowed when used memory > 'maxmemory'."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 1 | ▶ | my $db = 'db' . ( $o->{db} // 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$o{"db"} // 0
MC/DC0%0/1
$$o{"db"} // 0
$$o{"db"}
Truth table50%1/2
A
A= $$o{"db"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 1 | ▶ | my $d = $r->{data} //= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{"data"} //= {}
MC/DC0%0/1
$$r{"data"} //= {}
$$r{"data"}
Truth table50%1/2
A
A= $$r{"data"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 1 | ▶ | if ( $cmd eq 'DEL' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | my $n = grep { delete $d->{$_} } @w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $r->{keys}{$db}-- , $r->{deleted}++ for 1 .. $n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | return ( ( $raw ? '' : '(integer) ' ) . $n, 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | if ( $cmd eq 'EXPIRE' ) { return ( ( $raw ? '' : '(integer) ' ) . ( exists $d->{ $w[0] } ? 1 : 0 ), 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 1 | my $new = !exists $d->{ $w[0] }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 1 | ▶ | $d->{ $w[0] } = $cmd eq 'INCR' ? ( $d->{ $w[0] } // 0 ) + 1 : $cmd eq 'SETEX' ? $w[2] // '' : $w[1] // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
$$d{$w[0]} // 0
$w[2] // ""
$w[1] // ""
MC/DC0%0/1
$$d{$w[0]} // 0
$$d{$w[0]}
MC/DC0%0/1
$w[2] // ""
$w[2]
MC/DC0%0/1
$w[1] // ""
$w[1]
Truth table0%0/2
A
A= $$d{$w[0]}
Truth table0%0/2
A
A= $w[2]
Truth table50%1/2
A
A= $w[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 1 | ▶ | $r->{keys}{$db}++ if $new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 1 | ▶ | $r->{rdb_changes} = ( $r->{rdb_changes} // 0 ) + 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$r{"rdb_changes"} // 0
MC/DC0%0/1
$$r{"rdb_changes"} // 0
$$r{"rdb_changes"}
Truth table50%1/2
A
A= $$r{"rdb_changes"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 1 | ▶ | return ( $cmd eq 'INCR' ? ( $raw ? '' : '(integer) ' ) . $d->{ $w[0] } : $cmd =~ /PUSH|HSET/ ? ( $raw ? '' : '(integer) ' ) . 1 : 'OK', 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 27 | ▶ | if ( $cmd =~ /\A(?:GET|EXISTS|TTL|TYPE)\z/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 1 | ▶ | my $v = ( $r->{data} || {} )->{ $w[0] // '' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$$r{'data'} || {}
$w[0] // ""
MC/DC0%0/1
$$r{'data'} || {}
$$r{'data'}
MC/DC0%0/1
$w[0] // ""
$w[0]
Truth table50%1/2
A
A= $$r{'data'}
Truth table50%1/2
A
A= $w[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 1 | ▶ | return ( ( $raw ? '' : '(integer) ' ) . ( defined $v ? 1 : 0 ), 1 ) if $cmd eq 'EXISTS'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 1 | ▶ | return ( ( $raw ? '' : '(integer) ' ) . ( defined $v ? -1 : -2 ), 1 ) if $cmd eq 'TTL'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 1 | ▶ | return ( defined $v ? 'string' : 'none', 1 ) if $cmd eq 'TYPE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 1 | ▶ | return ( defined $v ? ( $raw ? $v : qq{"$v"} ) : $raw ? '' : '(nil)', 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 26 | ▶ | if ( $cmd eq 'SHUTDOWN' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | my $svc = $dev->{services}{ $r->{service} // 'redis-server' }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$r{"service"} // "redis-server"
MC/DC0%0/1
$$r{"service"} // "redis-server"
$$r{"service"}
Truth table0%0/2
A
A= $$r{"service"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | if ( $svc && $svc->{active} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$svc and $$svc{"active"}
MC/DC0%0/2
$svc and $$svc{"active"}
$svc
$$svc{"active"}
Truth table0%0/3
A and B
A= $svcB= $$svc{"active"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | my $nosave = grep { uc $_ eq 'NOSAVE' } @w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | _bgsave($dev) unless $nosave; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | $svc->{active} = JSON::MaybeXS::false(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | ▶ | $svc->{restarts} = ( $svc->{restarts} // 0 ) + 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$svc{"restarts"} // 0
MC/DC0%0/1
$$svc{"restarts"} // 0
$$svc{"restarts"}
Truth table0%0/2
A
A= $$svc{"restarts"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | return ( '', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | # DEBUG SLEEP s: der Befehl dauert s Sekunden; ab slowlog-log-slower-than (µs, >= 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | # ein Eintrag im Slowlog (Laufzeitspur _slowlog, hoechstens slowlog-max-len) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 26 | ▶ | if ( $cmd eq 'DEBUG' && uc( $w[0] // '' ) eq 'SLEEP' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$cmd eq "DEBUG" and uc($w[0] // "") eq "SLEEP"
$w[0] // ""
MC/DC50%1/2
$cmd eq "DEBUG" and uc($w[0] // "") eq "SLEEP"
$cmd eq "DEBUG"
$w[0]
Truth table66%2/3
A and B
A= $cmd eq "DEBUG"B= $w[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 5 | ▶ | my $s = $w[1] // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$w[1] // ""
MC/DC0%0/1
$w[1] // ""
$w[1]
Truth table50%1/2
A
A= $w[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 5 | ▶ | return _err("ERR value is not a valid float") unless $s =~ /\A\d+(?:\.\d+)?\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 5 | my $us = int( $s * 1e6 ) + 12; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 5 | ▶ | my $lim = $run->{'slowlog-log-slower-than'} // 10000; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$run{"slowlog-log-slower-than"} // 10000
MC/DC0%0/1
$$run{"slowlog-log-slower-than"} // 10000
$$run{"slowlog-log-slower-than"}
Truth table50%1/2
A
A= $$run{"slowlog-log-slower-than"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 5 | ▶ | if ( $lim =~ /\A\d+\z/ && $us >= $lim ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$lim =~ /\A\d+\z/ and $us >= $lim
MC/DC100%2/2
$lim =~ /\A\d+\z/ and $us >= $lim
$lim =~ /\A\d+\z/
$us >= $lim
Truth table100%3/3
A and B
A= $lim =~ /\A\d+\z/B= $us >= $lim
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 3 | ▶ | my $now = defined $dev->{clock} ? do { Langertha::Holmgang::Sim::Linux::_part('Monitoring'); Langertha::Holmgang::Sim::Linux::Monitoring::now_epoch($dev) } : 1792821600; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 3 | ▶ | my $id = $r->{_slowlog_next} // 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$$r{"_slowlog_next"} // 0
MC/DC100%1/1
$$r{"_slowlog_next"} // 0
$$r{"_slowlog_next"}
Truth table100%2/2
A
A= $$r{"_slowlog_next"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 3 | unshift @{ $r->{_slowlog} }, { id => $id, ts => $now, us => $us, args => [ 'DEBUG', 'SLEEP', $s ], client => '127.0.0.1:' . ( 43210 + $id ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 3 | $r->{_slowlog_next} = $id + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 3 | ▶ | my $max = $run->{'slowlog-max-len'} // 128; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$run{"slowlog-max-len"} // 128
MC/DC0%0/1
$$run{"slowlog-max-len"} // 128
$$run{"slowlog-max-len"}
Truth table50%1/2
A
A= $$run{"slowlog-max-len"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 3 | ▶ | splice @{ $r->{_slowlog} }, $max if $max =~ /\A\d+\z/ && @{ $r->{_slowlog} } > $max; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$max =~ /\A\d+\z/ and @{$$r{"_slowlog"};} > $max
MC/DC50%1/2
$max =~ /\A\d+\z/ and @{$$r{"_slowlog"};} > $max
$max =~ /\A\d+\z/
@{$$r{"_slowlog"};} > $max
Truth table66%2/3
A and B
A= $max =~ /\A\d+\z/B= @{$$r{"_slowlog"};} > $max
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 5 | return ( 'OK', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 21 | ▶ | if ( $cmd eq 'SLOWLOG' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 11 | ▶ | my $sub = uc( $w[0] // '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$w[0] // ""
MC/DC0%0/1
$w[0] // ""
$w[0]
Truth table50%1/2
A
A= $w[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 11 | ▶ | my @e = @{ $r->{_slowlog} || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$$r{'_slowlog'} || []
MC/DC100%1/1
$$r{'_slowlog'} || []
$$r{'_slowlog'}
Truth table100%2/2
A
A= $$r{'_slowlog'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 11 | ▶ | return ( ( $raw ? '' : '(integer) ' ) . scalar(@e), 1 ) if $sub eq 'LEN'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 5 | ▶ | if ( $sub eq 'RESET' ) { $r->{_slowlog} = []; return ( 'OK', 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 4 | ▶ | return _err("ERR unknown subcommand '" . lc( $w[0] // '' ) . "'. Try SLOWLOG HELP.") unless $sub eq 'GET'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$w[0] // ""
MC/DC0%0/1
$w[0] // ""
$w[0]
Truth table0%0/2
A
A= $w[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 4 | ▶ | my $n = $w[1] // 10; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$w[1] // 10
MC/DC100%1/1
$w[1] // 10
$w[1]
Truth table100%2/2
A
A= $w[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 4 | ▶ | @e = @e[ 0 .. $n - 1 ] if $n =~ /\A\d+\z/ && @e > $n; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$n =~ /\A\d+\z/ and @e > $n
MC/DC50%1/2
$n =~ /\A\d+\z/ and @e > $n
$n =~ /\A\d+\z/
@e > $n
Truth table66%2/3
A and B
A= $n =~ /\A\d+\z/B= @e > $n
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 4 | ▶ | return ( $raw ? '' : '(empty array)', 1 ) unless @e; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 3 | ▶ | if ($raw) { return ( join( "\n", map { ( $_->{id}, $_->{ts}, $_->{us}, @{ $_->{args} }, $_->{client}, '' ) } @e ), 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 2 | my @l; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 2 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 2 | for my $x (@e) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 3 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 3 | my $p = "$i) "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 3 | my $ind = ' ' x length $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 3 | my $j = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 3 | ▶ | my @args = map { $j++; ( $j == 1 ? '' : "$ind " ) . "$j) \"$_\"" } @{ $x->{args} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 3 | push @l, "${p}1) (integer) $x->{id}", "${ind}2) (integer) $x->{ts}", "${ind}3) (integer) $x->{us}", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | "${ind}4) $args[0]", @args[ 1 .. $#args ], "${ind}5) \"$x->{client}\"", "${ind}6) \"\""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 2 | return ( join( "\n", @l ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 10 | ▶ | if ( $cmd eq 'CONFIG' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 9 | ▶ | my $sub = uc( shift(@w) // '' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift @w // ""
MC/DC0%0/1
shift @w // ""
shift @w
Truth table50%1/2
A
A= shift @w
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 9 | ▶ | if ( $sub eq 'GET' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 2 | ▶ | return _err("ERR wrong number of arguments for 'config|get' command") unless @w; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 2 | my @out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 2 | for my $pat (@w) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 2 | ▶ | my $re = _glob_re( $ALIAS{ lc $pat } // $pat ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$Langertha::Holmgang::Sim::Linux::Redis::ALIAS{lc $pat} // $pat
MC/DC0%0/2
$Langertha::Holmgang::Sim::Linux::Redis::ALIAS{lc $pat} // $pat
$Langertha::Holmgang::Sim::Linux::Redis::ALIAS{lc $pat}
$pat
Truth table33%1/3
A // B
A= $Langertha::Holmgang::Sim::Linux::Redis::ALIAS{lc $pat}B= $pat
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 2 | for my $k ( sort keys %$run ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 64 | ▶ | next unless $k =~ $re; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 2 | ▶ | push @out, $k, $run->{$k} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$run{$k} // ""
MC/DC0%0/1
$$run{$k} // ""
$$run{$k}
Truth table50%1/2
A
A= $$run{$k}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 2 | return ( _fmt_bulk_list( $raw, @out ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 7 | ▶ | if ( $sub eq 'SET' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 6 | ▶ | return _err("ERR wrong number of arguments for 'config|set' command") unless @w && @w % 2 == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@w and @w % 2 == 0
MC/DC0%0/2
@w and @w % 2 == 0
@w
@w % 2 == 0
Truth table33%1/3
A and B
A= @wB= @w % 2 == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 6 | my %new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 6 | ▶ | while (@w) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 6 | my ( $k, $v ) = ( lc shift @w, shift @w ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 6 | ▶ | $k = $ALIAS{$k} // $k; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$Langertha::Holmgang::Sim::Linux::Redis::ALIAS{$k} // $k
MC/DC0%0/2
$Langertha::Holmgang::Sim::Linux::Redis::ALIAS{$k} // $k
$Langertha::Holmgang::Sim::Linux::Redis::ALIAS{$k}
$k
Truth table33%1/3
A // B
A= $Langertha::Holmgang::Sim::Linux::Redis::ALIAS{$k}B= $k
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 6 | ▶ | return _err("ERR Unknown option or number of arguments for CONFIG SET - '$k'") unless exists $DEFAULT{$k} || $k eq 'replicaof'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$k} or $k eq "replicaof"
MC/DC0%0/2
exists $Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$k} or $k eq "replicaof"
exists $Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$k}
$k eq "replicaof"
Truth table33%1/3
A or B
A= exists $Langertha::Holmgang::Sim::Linux::Redis::DEFAULT{$k}B= $k eq "replicaof"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 6 | ▶ | return _err("ERR CONFIG SET failed (possibly related to argument '$k') - can't set immutable config") if $IMMUTABLE{$k}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 5 | ▶ | return _err("ERR Unknown option or number of arguments for CONFIG SET - '$k'") if $k eq 'replicaof'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 5 | my ( $x, $e ) = _check_value( $k, $v ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 5 | ▶ | return _err("ERR CONFIG SET failed (possibly related to argument '$k') - $e") unless defined $x; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 4 | ▶ | if ( $k eq 'bind' ) { # jede Adresse muss gueltig und eine des Servers sein | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | my %own = map { s{/\d+\z}{}r => 1 } map { @{ $_->{addr} || [] } } values %{ $dev->{interfaces} || {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$$_{'addr'} || []
$$dev{'interfaces'} || {}
MC/DC0%0/1
$$_{'addr'} || []
$$_{'addr'}
MC/DC0%0/1
$$dev{'interfaces'} || {}
$$dev{'interfaces'}
Truth table0%0/2
A
A= $$_{'addr'}
Truth table50%1/2
A
A= $$dev{'interfaces'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 1 | $own{'127.0.0.1'} = $own{'::1'} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 1 | for my $a ( split /\s+/, $x ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 1 | ( my $b = $a ) =~ s/\A-//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 1 | ▶ | next if $b eq '*' || $b eq '0.0.0.0' || $b eq '::' || $own{$b}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$b eq "*" or $b eq "0.0.0.0" or $b eq "::" or $own{$b}
$b eq "*" or $b eq "0.0.0.0" or $b eq "::"
$b eq "*" or $b eq "0.0.0.0"
MC/DC0%0/4
$b eq "*" or $b eq "0.0.0.0" or $b eq "::" or $own{$b}
$b eq "*"
$b eq "0.0.0.0"
$b eq "::"
$own{$b}
Truth table20%1/5
A or B or C or D
A= $b eq "*"B= $b eq "0.0.0.0"C= $b eq "::"D= $own{$b}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 1 | return _err("ERR CONFIG SET failed (possibly related to argument 'bind') - Failed to bind to specified addresses."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 3 | $new{$k} = $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 3 | $run->{$_} = $new{$_} for keys %new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 3 | return ( 'OK', 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 1 | ▶ | if ( $sub eq 'REWRITE' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 1 | ▶ | return _rewrite($dev) ? ( 'OK', 1 ) : _err("ERR Rewriting config file: No such file or directory"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | if ( $sub eq 'RESETSTAT' ) { $r->{stats} = {}; return ( 'OK', 1 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | return _err("ERR unknown subcommand '" . lc($sub) . "'. Try CONFIG HELP."); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | # echter Redis-Befehl ohne Nachbildung: Luecke; sonst wie Redis: unbekannter Befehl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 1 | ▶ | if ( !$REAL_CMD{$cmd} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 1 | ▶ | my $args = join ' ', map {"'$_'"} @w[ 0 .. ( $#w < 2 ? $#w : 2 ) ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 1 | ▶ | return _err( "ERR unknown command '" . lc($cmd) . "', with args beginning with: " . ( length $args ? "$args " : '' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | push @GAPS, 'redis-cli ' . join( ' ', $cmd, @w ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | return ( '', 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 4 | %REAL_CMD = map { $_ => 1 } qw( APPEND BITCOUNT BLPOP BRPOP COPY DECR DECRBY DUMP ECHO EVAL EVALSHA EXPIREAT GETDEL GETEX GETRANGE GETSET HDEL HEXISTS HGET | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | HGETALL HINCRBY HKEYS HLEN HMGET HMSET HSCAN HVALS INCRBY INFO KEYS LINDEX LLEN LPOP LRANGE LREM MEMORY MGET MONITOR MOVE MSET OBJECT PERSIST PEXPIRE PTTL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | PUBLISH RANDOMKEY RENAME RPOP SADD SCAN SCARD SCRIPT SELECT SETNX SISMEMBER SLOWLOG SMEMBERS SREM STRLEN SUBSCRIBE SWAPDB TIME TOUCH UNLINK WAIT XADD XLEN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | XRANGE ZADD ZCARD ZRANGE ZREM ZSCORE LATENCY MODULE COMMAND DEBUG FAILOVER PSYNC SYNC LASTSAVE CLUSTER READONLY READWRITE RESET HELLO QUIT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | MULTI EXEC DISCARD WATCH UNWATCH PFADD PFCOUNT GEOADD ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 47 | ▶ | sub redis_cli { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
redis_cli: called CC=49 SCAR=50.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 47 | my ( $dev, $av, $ctx, $stdin ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 47 | my @a = @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 47 | my %o = ( host => '127.0.0.1', port => undef ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 47 | my @cmd; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 47 | ▶ | while (@a) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 54 | my $x = shift @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 54 | ▶ | if ( $x eq '-h' ) { $o{host} = shift @a } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 10 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | elsif ( $x eq '-p' ) { $o{port} = shift @a } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 3 | ▶ | elsif ( $x eq '-a' || $x eq '--pass' ) { $o{pass} = shift @a } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$x eq "-a" or $x eq "--pass"
MC/DC50%1/2
$x eq "-a" or $x eq "--pass"
$x eq "-a"
$x eq "--pass"
Truth table66%2/3
A or B
A= $x eq "-a"B= $x eq "--pass"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | elsif ( $x =~ /\A-a(.+)\z/ ) { $o{pass} = $1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | elsif ( $x eq '--user' ) { shift @a } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | elsif ( $x eq '-n' ) { $o{db} = shift @a } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 2 | elsif ( $x eq '--raw' ) { $o{raw} = 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | ▶ | elsif ( $x eq '--no-auth-warning' || $x eq '--no-raw' || $x eq '-e' ) { } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
$x eq "--no-auth-warning" or $x eq "--no-raw" or $x eq "-e"
$x eq "--no-auth-warning" or $x eq "--no-raw"
MC/DC33%1/3
$x eq "--no-auth-warning" or $x eq "--no-raw" or $x eq "-e"
$x eq "--no-auth-warning"
$x eq "--no-raw"
$x eq "-e"
Truth table50%2/4
A or B or C
A= $x eq "--no-auth-warning"B= $x eq "--no-raw"C= $x eq "-e"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | elsif ( $x eq '-u' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | ▶ | my $u = shift @a // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift @a // ""
MC/DC0%0/1
shift @a // ""
shift @a
Truth table0%0/2
A
A= shift @a
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | if ( $u =~ m{\Aredis://(?:[^:@]*:([^@]*)@)?([^:/]+)(?::(\d+))?(?:/(\d+))?} ) { $o{pass} = $1; $o{host} = $2; $o{port} = $3; $o{db} = $4 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | ▶ | elsif ( $x =~ /\A--(?:stat|bigkeys|memkeys|latency|scan|pipe|rdb|eval|cluster|ldb)/ || $x eq '-i' || $x eq '-r' || $x eq '-x' ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%6/9
$x =~ /\A--(?:stat|bigkeys|memkeys|latency|scan|pipe|rdb|eval|cluster|ldb)/ or $x eq "-i" or $x eq "-r" or $x eq "-x"
$x =~ /\A--(?:stat|bigkeys|memkeys|latency|scan|pipe|rdb|eval|cluster|ldb)/ or $x eq "-i" or $x eq "-r"
$x =~ /\A--(?:stat|bigkeys|memkeys|latency|scan|pipe|rdb|eval|cluster|ldb)/ or $x eq "-i"
MC/DC25%1/4
$x =~ /\A--(?:stat|bigkeys|memkeys|latency|scan|pipe|rdb|eval|cluster|ldb)/ or $x eq "-i" or $x eq "-r" or $x eq "-x"
$x =~ /\A--(?:stat|bigkeys|memkeys|latency|scan|pipe|rdb|eval|cluster|ldb)/
$x eq "-i"
$x eq "-r"
$x eq "-x"
Truth table40%2/5
A or B or C or D
A= $x =~ /\A--(?:stat|bigkeys|memkeys|latency|scan|pipe|rdb|eval|cluster|ldb)/B= $x eq "-i"C= $x eq "-r"D= $x eq "-x"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 1 | push @GAPS, join( ' ', 'redis-cli', @$av ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 1 | return ( '', 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 45 | else { @cmd = ( $x, @a ); last } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 46 | my $r = $dev->{redis}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 46 | ▶ | return ( 'Could not connect to Redis at ' . $o{host} . ':' . ( $o{port} // 6379 ) . ': Connection refused', 1 ) unless $r && _active($dev); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%3/5
$r and _active($dev)
$o{"port"} // 6379
MC/DC50%1/2
$r and _active($dev)
$r
_active($dev)
MC/DC0%0/1
$o{"port"} // 6379
$o{"port"}
Truth table66%2/3
A and B
A= $rB= _active($dev)
Truth table50%1/2
A
A= $o{"port"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 45 | my $run = _running($dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 45 | ▶ | $o{port} //= $run->{port}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$o{"port"} //= $$run{"port"}
MC/DC0%0/2
$o{"port"} //= $$run{"port"}
$o{"port"}
$$run{"port"}
Truth table33%1/3
A //= B
A= $o{"port"}B= $$run{"port"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | return ( "Could not connect to Redis at $o{host}:$o{port}: Connection refused", 1 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 45 | ▶ | unless $o{port} eq $run->{port} && ( _bound_to( $dev, $o{host} ) || ( $ctx->{host} // '' ) eq $o{host} && _bound_to( $dev, '127.0.0.1' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition18%2/11
$o{"port"} eq $$run{"port"} and _bound_to($dev, $o{"host"}) || ($$ctx{"host"} // "") eq $o{"host"} && _bound_to($dev, "127.0.0.1")
_bound_to($dev, $o{"host"}) or ($$ctx{"host"} // "") eq $o{"host"} and _bound_to($dev, "127.0.0.1")
($$ctx{"host"} // "") eq $o{"host"} and _bound_to($dev, "127.0.0.1")
$$ctx{"host"} // ""
MC/DC0%0/4
$o{"port"} eq $$run{"port"} and _bound_to($dev, $o{"host"}) || ($$ctx{"host"} // "") eq $o{"host"} && _bound_to($dev, "127.0.0.1")
$o{"port"} eq $$run{"port"}
_bound_to($dev, $o{"host"})
$$ctx{"host"}
_bound_to($dev, "127.0.0.1")
Truth table20%1/5
A and B or C and D
A= $o{"port"} eq $$run{"port"}B= _bound_to($dev, $o{"host"})C= $$ctx{"host"}D= _bound_to($dev, "127.0.0.1")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 45 | my $quiet = grep { $_ eq '--no-auth-warning' } @$av; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 45 | ▶ | my @warn = defined $o{pass} && !$quiet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $o{"pass"} and not $quiet
MC/DC100%2/2
defined $o{"pass"} and not $quiet
defined $o{"pass"}
not $quiet
Truth table100%3/3
A and not(B)
A= defined $o{"pass"}B= not $quiet
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | ? ('Warning: Using a password with \'-a\' or \'-u\' option on the command line interface may not be safe.') : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 45 | ▶ | if ( defined $o{pass} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 3 | ▶ | my $rp = $run->{requirepass} // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$$run{"requirepass"} // ""
MC/DC0%0/1
$$run{"requirepass"} // ""
$$run{"requirepass"}
Truth table50%1/2
A
A= $$run{"requirepass"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 3 | ▶ | if ( $rp ne '' && $o{pass} eq $rp ) { $o{authed} = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$rp ne "" and $o{"pass"} eq $rp
MC/DC0%0/2
$rp ne "" and $o{"pass"} eq $rp
$rp ne ""
$o{"pass"} eq $rp
Truth table33%1/3
A and B
A= $rp ne ""B= $o{"pass"} eq $rp
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | elsif ( $rp ne '' ) { return ( join( "\n", @warn, 'AUTH failed: WRONGPASS invalid username-password pair or user is disabled.' ), 1 ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | # nach einer gescheiterten Sicherung versucht Redis es selbst alle paar Sekunden neu | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 45 | ▶ | _bgsave($dev) if !( $r->{rdb_ok} // 1 ) && ( $run->{save} // '' ) ne '' && !_need_failing( $dev, $r->{bgsave_needs} ) && !_need_failing( $dev, $r->{fork_needs} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition76%10/13
not $$r{"rdb_ok"} // 1 and ($$run{"save"} // "") ne "" and not _need_failing($dev, $$r{"bgsave_needs"}) and not _need_failing($dev, $$r{"fork_needs"})
not $$r{"rdb_ok"} // 1 and ($$run{"save"} // "") ne "" and not _need_failing($dev, $$r{"bgsave_needs"})
not $$r{"rdb_ok"} // 1 and ($$run{"save"} // "") ne ""
$$r{"rdb_ok"} // 1
$$run{"save"} // ""
MC/DC0%0/4
not $$r{"rdb_ok"} // 1 and ($$run{"save"} // "") ne "" and not _need_failing($dev, $$r{"bgsave_needs"}) and not _need_failing($dev, $$r{"fork_needs"})
$$r{"rdb_ok"}
$$run{"save"}
not _need_failing($dev, $$r{"bgsave_needs"})
not _need_failing($dev, $$r{"fork_needs"})
Truth table20%1/5
not(A) and B and not(C) and not(D)
A= $$r{"rdb_ok"}B= $$run{"save"}C= not _need_failing($dev, $$r{"bgsave_needs"})D= not _need_failing($dev, $$r{"fork_needs"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 45 | ▶ | my @lines = @cmd ? ( [@cmd] ) : map { [ grep { !ref } Langertha::Holmgang::Shell::shell_words($_) ] } grep {/\S/} split /\n/, $stdin // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$stdin // ""
MC/DC0%0/1
$stdin // ""
$stdin
Truth table50%1/2
A
A= $stdin
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | ▶ | if ( !@lines ) { push @GAPS, 'redis-cli (interaktiv)'; return ( '', 0 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 45 | my @out = @warn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 45 | for my $l (@lines) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 45 | my ( $t, $k ) = _command( $dev, $l, \%o ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 45 | ▶ | push @out, $t if defined $t && length $t; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $t and length $t
MC/DC0%0/2
defined $t and length $t
defined $t
length $t
Truth table33%1/3
A and B
A= defined $tB= length $t
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 45 | ▶ | return ( join( "\n", @out ), 0 ) unless $k; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 45 | return ( join( "\n", @out ), 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||