cleanup based on 6.2.2 merge review

Former-commit-id: 51277b17a7ab4bb5b3f06fd5af8f26257ac35a37
This commit is contained in:
malavan 2021-06-11 15:32:04 +00:00 committed by John Sully
parent 5019f9c537
commit c255a454ec
19 changed files with 67 additions and 79 deletions

4
TLS.md
View File

@ -28,8 +28,8 @@ To manually run a Redis server with TLS mode (assuming `gen-test-certs.sh` was
invoked so sample certificates/keys are available): invoked so sample certificates/keys are available):
./src/keydb-server --tls-port 6379 --port 0 \ ./src/keydb-server --tls-port 6379 --port 0 \
--tls-cert-file ./tests/tls/keydb.crt \ --tls-cert-file ./tests/tls/client.crt \
--tls-key-file ./tests/tls/keydb.key \ --tls-key-file ./tests/tls/client.key \
--tls-ca-cert-file ./tests/tls/ca.crt --tls-ca-cert-file ./tests/tls/ca.crt
To connect to this Redis server with `keydb-cli`: To connect to this Redis server with `keydb-cli`:

View File

@ -10,7 +10,7 @@ done
if [ -z $TCLSH ] if [ -z $TCLSH ]
then then
echo "You need tcl 8.5 or newer in order to run the Redis test" echo "You need tcl 8.5 or newer in order to run the KeyDB test"
exit 1 exit 1
fi fi
$TCLSH tests/test_helper.tcl "${@}" $TCLSH tests/test_helper.tcl "${@}"

View File

@ -8,7 +8,7 @@ done
if [ -z $TCLSH ] if [ -z $TCLSH ]
then then
echo "You need tcl 8.5 or newer in order to run the Redis Cluster test" echo "You need tcl 8.5 or newer in order to run the KeyDB Cluster test"
exit 1 exit 1
fi fi
$TCLSH tests/cluster/run.tcl $* $TCLSH tests/cluster/run.tcl $*

View File

@ -9,7 +9,7 @@ done
if [ -z $TCLSH ] if [ -z $TCLSH ]
then then
echo "You need tcl 8.5 or newer in order to run the Redis ModuleApi test" echo "You need tcl 8.5 or newer in order to run the KeyDB ModuleApi test"
exit 1 exit 1
fi fi

View File

@ -8,7 +8,7 @@ done
if [ -z $TCLSH ] if [ -z $TCLSH ]
then then
echo "You need tcl 8.5 or newer in order to run the Redis Sentinel test" echo "You need tcl 8.5 or newer in order to run the KeyDB Sentinel test"
exit 1 exit 1
fi fi
$TCLSH tests/sentinel/run.tcl $* $TCLSH tests/sentinel/run.tcl $*

View File

@ -173,12 +173,11 @@ void queueClientForReprocessing(client *c) {
/* The client may already be into the unblocked list because of a previous /* The client may already be into the unblocked list because of a previous
* blocking operation, don't add back it into the list multiple times. */ * blocking operation, don't add back it into the list multiple times. */
serverAssert(GlobalLocksAcquired()); serverAssert(GlobalLocksAcquired());
fastlock_lock(&c->lock); std::unique_lock<fastlock> ul(c->lock);
if (!(c->flags & CLIENT_UNBLOCKED)) { if (!(c->flags & CLIENT_UNBLOCKED)) {
c->flags |= CLIENT_UNBLOCKED; c->flags |= CLIENT_UNBLOCKED;
listAddNodeTail(g_pserver->rgthreadvar[c->iel].unblocked_clients,c); listAddNodeTail(g_pserver->rgthreadvar[c->iel].unblocked_clients,c);
} }
fastlock_unlock(&c->lock);
} }
/* Unblock a client calling the right function depending on the kind /* Unblock a client calling the right function depending on the kind

View File

@ -561,7 +561,7 @@ void clusterInit(void) {
serverAssert(serverTL == &g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN]); serverAssert(serverTL == &g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN]);
if (createSocketAcceptHandler(&g_pserver->cfd, clusterAcceptHandler) != C_OK) { if (createSocketAcceptHandler(&g_pserver->cfd, clusterAcceptHandler) != C_OK) {
serverPanic("Unrecoverable error creating Redis Cluster socket accept handler."); serverPanic("Unrecoverable error creating KeyDB Cluster socket accept handler.");
} }
/* The slots -> keys map is a radix tree. Initialize it here. */ /* The slots -> keys map is a radix tree. Initialize it here. */

View File

@ -1403,9 +1403,8 @@ void copyCommand(client *c) {
} }
dbAdd(dst,newkey,newobj); dbAdd(dst,newkey,newobj);
if (expire != nullptr) { if (expire != nullptr)
if (expire != nullptr) setExpire(c, dst, newkey, expire->duplicate()); setExpire(c, dst, newkey, expire->duplicate());
}
/* OK! key copied */ /* OK! key copied */
signalModifiedKey(c,dst,c->argv[2]); signalModifiedKey(c,dst,c->argv[2]);

View File

@ -1038,7 +1038,6 @@ void _serverPanic(const char *file, int line, const char *msg, ...) {
vsnprintf(fmtmsg,sizeof(fmtmsg),msg,ap); vsnprintf(fmtmsg,sizeof(fmtmsg),msg,ap);
va_end(ap); va_end(ap);
g_fInCrash = true;
bugReportStart(); bugReportStart();
serverLog(LL_WARNING,"------------------------------------------------"); serverLog(LL_WARNING,"------------------------------------------------");
serverLog(LL_WARNING,"!!! Software Failure. Press left mouse button to continue"); serverLog(LL_WARNING,"!!! Software Failure. Press left mouse button to continue");

View File

@ -426,7 +426,7 @@ sds createLatencyReport(void) {
} }
if (advise_slowlog_inspect) { if (advise_slowlog_inspect) {
report = sdscat(report,"- Check your Slow Log to understand what are the commands you are running which are too slow to execute. Please check https://redis.io/commands/slowlog for more information.\n"); report = sdscat(report,"- Check your Slow Log to understand what are the commands you are running which are too slow to execute. Please check https://docs.keydb.dev/docs/commands#slowlog for more information.\n");
} }
/* Intrinsic latency. */ /* Intrinsic latency. */

View File

@ -57,7 +57,6 @@
#include <limits.h> #include <limits.h>
#include <float.h> #include <float.h>
#include <math.h> #include <math.h>
#include <sys/resource.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <locale.h> #include <locale.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -67,7 +66,6 @@
#include "aelocker.h" #include "aelocker.h"
#include "motd.h" #include "motd.h"
#include "t_nhash.h" #include "t_nhash.h"
#include <sys/resource.h>
#ifdef __linux__ #ifdef __linux__
#include <sys/prctl.h> #include <sys/prctl.h>
#include <sys/mman.h> #include <sys/mman.h>
@ -4645,10 +4643,6 @@ int prepareForShutdown(int flags) {
overwrite the synchronous saving did by SHUTDOWN. */ overwrite the synchronous saving did by SHUTDOWN. */
if (g_pserver->child_type == CHILD_TYPE_RDB) { if (g_pserver->child_type == CHILD_TYPE_RDB) {
serverLog(LL_WARNING,"There is a child saving an .rdb. Killing it!"); serverLog(LL_WARNING,"There is a child saving an .rdb. Killing it!");
/* Note that, in killRDBChild, we call rdbRemoveTempFile that will
* do close fd(in order to unlink file actully) in background thread.
* The temp rdb file fd may won't be closed when redis exits quickly,
* but OS will close this fd when process exits. */
killRDBChild(); killRDBChild();
/* Note that, in killRDBChild normally has backgroundSaveDoneHandler /* Note that, in killRDBChild normally has backgroundSaveDoneHandler
* doing it's cleanup, but in this case this code will not be reached, * doing it's cleanup, but in this case this code will not be reached,

View File

@ -813,7 +813,7 @@ int64_t streamTrim(stream *s, streamAddTrimArgs *args) {
} }
deleted += deleted_from_lp; deleted += deleted_from_lp;
/* Now we the entries/deleted counters. */ /* Now we update the entries/deleted counters. */
p = lpFirst(lp); p = lpFirst(lp);
lp = lpReplaceInteger(lp,&p,entries-deleted_from_lp); lp = lpReplaceInteger(lp,&p,entries-deleted_from_lp);
p = lpNext(lp,p); /* Skip deleted field. */ p = lpNext(lp,p); /* Skip deleted field. */

View File

@ -36,7 +36,7 @@ set ::run_matching {} ; # If non empty, only tests matching pattern are run.
if {[catch {cd tmp}]} { if {[catch {cd tmp}]} {
puts "tmp directory not found." puts "tmp directory not found."
puts "Please run this test from the Redis source root." puts "Please run this test from the KeyDB source root."
exit 1 exit 1
} }
@ -303,7 +303,7 @@ proc pause_on_error {} {
set count 10 set count 10
if {[lindex $argv 1] ne {}} {set count [lindex $argv 1]} if {[lindex $argv 1] ne {}} {set count [lindex $argv 1]}
foreach_redis_id id { foreach_redis_id id {
puts "=== REDIS $id ====" puts "=== KeyDB $id ===="
puts [exec tail -$count redis_$id/log.txt] puts [exec tail -$count redis_$id/log.txt]
puts "---------------------\n" puts "---------------------\n"
} }
@ -317,7 +317,7 @@ proc pause_on_error {} {
} }
} elseif {$cmd eq {ls}} { } elseif {$cmd eq {ls}} {
foreach_redis_id id { foreach_redis_id id {
puts -nonewline "Redis $id" puts -nonewline "KeyDB $id"
set errcode [catch { set errcode [catch {
set str {} set str {}
append str "@[RI $id tcp_port]: " append str "@[RI $id tcp_port]: "
@ -348,13 +348,13 @@ proc pause_on_error {} {
} }
} }
} elseif {$cmd eq {help}} { } elseif {$cmd eq {help}} {
puts "ls List Sentinel and Redis instances." puts "ls List Sentinel and KeyDB instances."
puts "show-sentinel-logs \[N\] Show latest N lines of logs." puts "show-sentinel-logs \[N\] Show latest N lines of logs."
puts "show-keydb-logs \[N\] Show latest N lines of logs." puts "show-keydb-logs \[N\] Show latest N lines of logs."
puts "S <id> cmd ... arg Call command in Sentinel <id>." puts "S <id> cmd ... arg Call command in Sentinel <id>."
puts "R <id> cmd ... arg Call command in Redis <id>." puts "R <id> cmd ... arg Call command in KeyDB <id>."
puts "SI <id> <field> Show Sentinel <id> INFO <field>." puts "SI <id> <field> Show Sentinel <id> INFO <field>."
puts "RI <id> <field> Show Redis <id> INFO <field>." puts "RI <id> <field> Show KeyDB <id> INFO <field>."
puts "continue Resume test." puts "continue Resume test."
} else { } else {
set errcode [catch {eval $line} retval] set errcode [catch {eval $line} retval]

View File

@ -1,12 +1,11 @@
set system_name [string tolower [exec uname -s]] set system_name [string tolower [exec uname -s]]
# ldd --version returns 1 under musl for unknown reasons. If this check stops working, that may be why # ldd --version returns 1 under musl for unknown reasons. If this check stops working, that may be why
set is_musl [catch {exec ldd --version}]
set system_supported 0 set system_supported 0
# We only support darwin or Linux with glibc # We only support darwin or Linux with glibc
if {$system_name eq {darwin}} { if {$system_name eq {darwin}} {
set system_supported 1 set system_supported 1
} elseif {$system_name eq {linux} && $is_musl eq 0} { } elseif {$system_name eq {linux}} {
# Avoid the test on libmusl, which does not support backtrace # Avoid the test on libmusl, which does not support backtrace
set ldd [exec ldd src/keydb-server] set ldd [exec ldd src/keydb-server]
if {![string match {*libc.musl*} $ldd]} { if {![string match {*libc.musl*} $ldd]} {

View File

@ -5,7 +5,7 @@ proc show_cluster_status {} {
# time info. Logs are in the following form: # time info. Logs are in the following form:
# #
# 11296:M 25 May 2020 17:37:14.652 # Server initialized # 11296:M 25 May 2020 17:37:14.652 # Server initialized
set log_regexp {^[0-9]+:^[0-9]+:[A-Z] [0-9]+ [A-z]+ [0-9]+ ([0-9:.]+) .*} set log_regexp {^[0-9]+:[A-Z] [0-9]+ [A-z]+ [0-9]+ ([0-9:.]+) .*}
set repl_regexp {(master|repl|sync|backlog|meaningful|offset)} set repl_regexp {(master|repl|sync|backlog|meaningful|offset)}
puts "Master ID is $master_id" puts "Master ID is $master_id"

View File

@ -57,8 +57,8 @@ set ::all_tests {
integration/psync2-reg integration/psync2-reg
integration/psync2-pingoff integration/psync2-pingoff
integration/failover integration/failover
integration/redis-cli integration/keydb-cli
integration/redis-benchmark integration/keydb-benchmark
unit/pubsub unit/pubsub
unit/slowlog unit/slowlog
unit/scripting unit/scripting

View File

@ -62,7 +62,6 @@ start_server {overrides {save ""} tags {"other"}} {
} {*index is out of range*} } {*index is out of range*}
tags {consistency} { tags {consistency} {
if {true} {
if {$::accurate} {set numops 10000} else {set numops 1000} if {$::accurate} {set numops 10000} else {set numops 1000}
test {Check consistency of different data types after a reload} { test {Check consistency of different data types after a reload} {
r flushdb r flushdb
@ -113,7 +112,6 @@ start_server {overrides {save ""} tags {"other"}} {
} }
} {1} } {1}
} }
}
test {EXPIRES after a reload (snapshot + append only file rewrite)} { test {EXPIRES after a reload (snapshot + append only file rewrite)} {
r flushdb r flushdb