2011-12-19 04:21:50 -05:00
|
|
|
start_server {tags {"introspection"}} {
|
|
|
|
test {CLIENT LIST} {
|
|
|
|
r client list
|
2018-08-13 12:57:22 -04:00
|
|
|
} {*addr=*:* fd=* age=* idle=* flags=N db=9 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=* obl=0 oll=0 omem=0 events=r cmd=client*}
|
2012-04-07 05:26:24 -04:00
|
|
|
|
|
|
|
test {MONITOR can log executed commands} {
|
|
|
|
set rd [redis_deferring_client]
|
|
|
|
$rd monitor
|
2015-08-12 01:56:17 -04:00
|
|
|
assert_match {*OK*} [$rd read]
|
2012-04-07 05:26:24 -04:00
|
|
|
r set foo bar
|
|
|
|
r get foo
|
2015-08-12 01:56:17 -04:00
|
|
|
list [$rd read] [$rd read]
|
|
|
|
} {*"set" "foo"*"get" "foo"*}
|
2012-04-07 05:26:24 -04:00
|
|
|
|
|
|
|
test {MONITOR can log commands issued by the scripting engine} {
|
|
|
|
set rd [redis_deferring_client]
|
|
|
|
$rd monitor
|
|
|
|
$rd read ;# Discard the OK
|
2015-08-12 01:56:17 -04:00
|
|
|
r eval {redis.call('set',KEYS[1],ARGV[1])} 1 foo bar
|
2012-04-07 05:26:24 -04:00
|
|
|
assert_match {*eval*} [$rd read]
|
|
|
|
assert_match {*lua*"set"*"foo"*"bar"*} [$rd read]
|
|
|
|
}
|
2013-01-14 04:19:20 -05:00
|
|
|
|
|
|
|
test {CLIENT GETNAME should return NIL if name is not assigned} {
|
|
|
|
r client getname
|
|
|
|
} {}
|
|
|
|
|
|
|
|
test {CLIENT LIST shows empty fields for unassigned names} {
|
|
|
|
r client list
|
|
|
|
} {*name= *}
|
2014-07-31 14:39:49 -04:00
|
|
|
|
2013-01-14 04:19:20 -05:00
|
|
|
test {CLIENT SETNAME does not accept spaces} {
|
|
|
|
catch {r client setname "foo bar"} e
|
|
|
|
set e
|
|
|
|
} {ERR*}
|
|
|
|
|
|
|
|
test {CLIENT SETNAME can assign a name to this connection} {
|
|
|
|
assert_equal [r client setname myname] {OK}
|
|
|
|
r client list
|
|
|
|
} {*name=myname*}
|
|
|
|
|
|
|
|
test {CLIENT SETNAME can change the name of an existing connection} {
|
|
|
|
assert_equal [r client setname someothername] {OK}
|
|
|
|
r client list
|
|
|
|
} {*name=someothername*}
|
|
|
|
|
|
|
|
test {After CLIENT SETNAME, connection can still be closed} {
|
|
|
|
set rd [redis_deferring_client]
|
|
|
|
$rd client setname foobar
|
|
|
|
assert_equal [$rd read] "OK"
|
|
|
|
assert_match {*foobar*} [r client list]
|
|
|
|
$rd close
|
|
|
|
# Now the client should no longer be listed
|
2013-02-12 07:27:24 -05:00
|
|
|
wait_for_condition 50 100 {
|
|
|
|
[string match {*foobar*} [r client list]] == 0
|
|
|
|
} else {
|
|
|
|
fail "Client still listed in CLIENT LIST after SETNAME."
|
|
|
|
}
|
|
|
|
}
|
2019-11-28 04:24:57 -05:00
|
|
|
|
2020-09-09 08:12:57 -04:00
|
|
|
test {CONFIG save params special case handled properly} {
|
|
|
|
# No "save" keyword - defaults should apply
|
|
|
|
start_server {config "minimal.conf"} {
|
|
|
|
assert_match [r config get save] {save {3600 1 300 100 60 10000}}
|
|
|
|
}
|
|
|
|
|
|
|
|
# First "save" keyword overrides defaults
|
|
|
|
start_server {config "minimal.conf" overrides {save {100 100}}} {
|
|
|
|
# Defaults
|
|
|
|
assert_match [r config get save] {save {100 100}}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-28 04:24:57 -05:00
|
|
|
test {CONFIG sanity} {
|
|
|
|
# Do CONFIG GET, CONFIG SET and then CONFIG GET again
|
|
|
|
# Skip immutable configs, one with no get, and other complicated configs
|
|
|
|
set skip_configs {
|
|
|
|
rdbchecksum
|
|
|
|
daemonize
|
|
|
|
io-threads-do-reads
|
2019-12-26 06:59:58 -05:00
|
|
|
tcp-backlog
|
2019-11-28 04:24:57 -05:00
|
|
|
always-show-logo
|
|
|
|
syslog-enabled
|
|
|
|
cluster-enabled
|
|
|
|
aclfile
|
|
|
|
unixsocket
|
|
|
|
pidfile
|
|
|
|
syslog-ident
|
|
|
|
appendfilename
|
|
|
|
supervised
|
|
|
|
syslog-facility
|
|
|
|
databases
|
|
|
|
port
|
|
|
|
tls-port
|
2020-07-10 04:33:47 -04:00
|
|
|
io-threads
|
2019-11-28 04:24:57 -05:00
|
|
|
logfile
|
|
|
|
unixsocketperm
|
|
|
|
slaveof
|
|
|
|
bind
|
|
|
|
requirepass
|
Support setcpuaffinity on linux/bsd
Currently, there are several types of threads/child processes of a
redis server. Sometimes we need deeply optimise the performance of
redis, so we would like to isolate threads/processes.
There were some discussion about cpu affinity cases in the issue:
https://github.com/antirez/redis/issues/2863
So implement cpu affinity setting by redis.conf in this patch, then
we can config server_cpulist/bio_cpulist/aof_rewrite_cpulist/
bgsave_cpulist by cpu list.
Examples of cpulist in redis.conf:
server_cpulist 0-7:2 means cpu affinity 0,2,4,6
bio_cpulist 1,3 means cpu affinity 1,3
aof_rewrite_cpulist 8-11 means cpu affinity 8,9,10,11
bgsave_cpulist 1,10-11 means cpu affinity 1,10,11
Test on linux/freebsd, both work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2020-05-02 08:05:39 -04:00
|
|
|
server_cpulist
|
|
|
|
bio_cpulist
|
|
|
|
aof_rewrite_cpulist
|
|
|
|
bgsave_cpulist
|
2019-11-28 04:24:57 -05:00
|
|
|
}
|
|
|
|
|
2020-07-10 04:33:47 -04:00
|
|
|
if {!$::tls} {
|
|
|
|
append skip_configs {
|
|
|
|
tls-prefer-server-ciphers
|
|
|
|
tls-session-cache-timeout
|
|
|
|
tls-session-cache-size
|
|
|
|
tls-session-caching
|
|
|
|
tls-cert-file
|
|
|
|
tls-key-file
|
|
|
|
tls-dh-params-file
|
|
|
|
tls-ca-cert-file
|
|
|
|
tls-ca-cert-dir
|
|
|
|
tls-protocols
|
|
|
|
tls-ciphers
|
|
|
|
tls-ciphersuites
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-28 04:24:57 -05:00
|
|
|
set configs {}
|
|
|
|
foreach {k v} [r config get *] {
|
|
|
|
if {[lsearch $skip_configs $k] != -1} {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
dict set configs $k $v
|
|
|
|
# try to set the config to the same value it already has
|
|
|
|
r config set $k $v
|
|
|
|
}
|
|
|
|
|
|
|
|
set newconfigs {}
|
|
|
|
foreach {k v} [r config get *] {
|
|
|
|
if {[lsearch $skip_configs $k] != -1} {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
dict set newconfigs $k $v
|
|
|
|
}
|
|
|
|
|
|
|
|
dict for {k v} $configs {
|
|
|
|
set vv [dict get $newconfigs $k]
|
|
|
|
if {$v != $vv} {
|
|
|
|
fail "config $k mismatch, expecting $v but got $vv"
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2020-09-09 08:43:11 -04:00
|
|
|
|
|
|
|
# Do a force-all config rewrite and make sure we're able to parse
|
|
|
|
# it.
|
|
|
|
test {CONFIG REWRITE sanity} {
|
|
|
|
# Capture state of config before
|
|
|
|
set configs {}
|
|
|
|
foreach {k v} [r config get *] {
|
|
|
|
dict set configs $k $v
|
|
|
|
}
|
|
|
|
|
|
|
|
# Rewrite entire configuration, restart and confirm the
|
|
|
|
# server is able to parse it and start.
|
|
|
|
assert_equal [r debug config-rewrite-force-all] "OK"
|
|
|
|
restart_server 0 0
|
|
|
|
assert_equal [r ping] "PONG"
|
|
|
|
|
|
|
|
# Verify no changes were introduced
|
|
|
|
dict for {k v} $configs {
|
|
|
|
assert_equal $v [lindex [r config get $k] 1]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Config file at this point is at a wierd state, and includes all
|
|
|
|
# known keywords. Might be a good idea to avoid adding tests here.
|
2011-12-19 04:21:50 -05:00
|
|
|
}
|