diff --git a/TLS.md b/TLS.md index 6373ff871..9d083bb3a 100644 --- a/TLS.md +++ b/TLS.md @@ -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): ./src/keydb-server --tls-port 6379 --port 0 \ - --tls-cert-file ./tests/tls/keydb.crt \ - --tls-key-file ./tests/tls/keydb.key \ + --tls-cert-file ./tests/tls/client.crt \ + --tls-key-file ./tests/tls/client.key \ --tls-ca-cert-file ./tests/tls/ca.crt To connect to this Redis server with `keydb-cli`: diff --git a/runtest b/runtest index c6349d118..dec3ee0cb 100755 --- a/runtest +++ b/runtest @@ -10,7 +10,7 @@ done if [ -z $TCLSH ] 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 fi $TCLSH tests/test_helper.tcl "${@}" diff --git a/runtest-cluster b/runtest-cluster index a86e93141..3a6d20978 100755 --- a/runtest-cluster +++ b/runtest-cluster @@ -8,7 +8,7 @@ done if [ -z $TCLSH ] 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 fi $TCLSH tests/cluster/run.tcl $* diff --git a/runtest-moduleapi b/runtest-moduleapi index dc4c9e1ea..154818ed8 100755 --- a/runtest-moduleapi +++ b/runtest-moduleapi @@ -9,7 +9,7 @@ done if [ -z $TCLSH ] 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 fi diff --git a/runtest-sentinel b/runtest-sentinel index 3fb1ef615..57a6c75bb 100755 --- a/runtest-sentinel +++ b/runtest-sentinel @@ -8,7 +8,7 @@ done if [ -z $TCLSH ] 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 fi $TCLSH tests/sentinel/run.tcl $* diff --git a/src/blocked.cpp b/src/blocked.cpp index c6d157a9c..f3d4ec9e5 100644 --- a/src/blocked.cpp +++ b/src/blocked.cpp @@ -173,12 +173,11 @@ void queueClientForReprocessing(client *c) { /* 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. */ serverAssert(GlobalLocksAcquired()); - fastlock_lock(&c->lock); + std::unique_lock ul(c->lock); if (!(c->flags & CLIENT_UNBLOCKED)) { c->flags |= CLIENT_UNBLOCKED; listAddNodeTail(g_pserver->rgthreadvar[c->iel].unblocked_clients,c); } - fastlock_unlock(&c->lock); } /* Unblock a client calling the right function depending on the kind @@ -792,4 +791,4 @@ void signalKeyAsReady(redisDb *db, sds key, int type) { redisObjectStack o; initStaticStringObject(o, key); signalKeyAsReady(db, &o, type); -} \ No newline at end of file +} diff --git a/src/cluster.cpp b/src/cluster.cpp index 3c9f23841..1acd9fdbf 100644 --- a/src/cluster.cpp +++ b/src/cluster.cpp @@ -561,7 +561,7 @@ void clusterInit(void) { serverAssert(serverTL == &g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN]); 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. */ diff --git a/src/db.cpp b/src/db.cpp index 56840e128..c69e19506 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -1403,9 +1403,8 @@ void copyCommand(client *c) { } dbAdd(dst,newkey,newobj); - if (expire != nullptr) { - if (expire != nullptr) setExpire(c, dst, newkey, expire->duplicate()); - } + if (expire != nullptr) + setExpire(c, dst, newkey, expire->duplicate()); /* OK! key copied */ signalModifiedKey(c,dst,c->argv[2]); diff --git a/src/debug.cpp b/src/debug.cpp index 021cf9c4a..7b7fe29e1 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -1038,7 +1038,6 @@ void _serverPanic(const char *file, int line, const char *msg, ...) { vsnprintf(fmtmsg,sizeof(fmtmsg),msg,ap); va_end(ap); - g_fInCrash = true; bugReportStart(); serverLog(LL_WARNING,"------------------------------------------------"); serverLog(LL_WARNING,"!!! Software Failure. Press left mouse button to continue"); diff --git a/src/latency.cpp b/src/latency.cpp index 461786c53..505543b30 100644 --- a/src/latency.cpp +++ b/src/latency.cpp @@ -426,7 +426,7 @@ sds createLatencyReport(void) { } 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. */ diff --git a/src/server.cpp b/src/server.cpp index ca9fde836..8a491c3f0 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -57,7 +57,6 @@ #include #include #include -#include #include #include #include @@ -67,7 +66,6 @@ #include "aelocker.h" #include "motd.h" #include "t_nhash.h" -#include #ifdef __linux__ #include #include @@ -4645,10 +4643,6 @@ int prepareForShutdown(int flags) { overwrite the synchronous saving did by SHUTDOWN. */ if (g_pserver->child_type == CHILD_TYPE_RDB) { 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(); /* Note that, in killRDBChild normally has backgroundSaveDoneHandler * doing it's cleanup, but in this case this code will not be reached, diff --git a/src/t_stream.cpp b/src/t_stream.cpp index 483ae7817..828b9353b 100644 --- a/src/t_stream.cpp +++ b/src/t_stream.cpp @@ -813,7 +813,7 @@ int64_t streamTrim(stream *s, streamAddTrimArgs *args) { } deleted += deleted_from_lp; - /* Now we the entries/deleted counters. */ + /* Now we update the entries/deleted counters. */ p = lpFirst(lp); lp = lpReplaceInteger(lp,&p,entries-deleted_from_lp); p = lpNext(lp,p); /* Skip deleted field. */ diff --git a/tests/instances.tcl b/tests/instances.tcl index e494e741c..d5008faca 100644 --- a/tests/instances.tcl +++ b/tests/instances.tcl @@ -36,7 +36,7 @@ set ::run_matching {} ; # If non empty, only tests matching pattern are run. if {[catch {cd tmp}]} { 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 } @@ -303,7 +303,7 @@ proc pause_on_error {} { set count 10 if {[lindex $argv 1] ne {}} {set count [lindex $argv 1]} foreach_redis_id id { - puts "=== REDIS $id ====" + puts "=== KeyDB $id ====" puts [exec tail -$count redis_$id/log.txt] puts "---------------------\n" } @@ -317,7 +317,7 @@ proc pause_on_error {} { } } elseif {$cmd eq {ls}} { foreach_redis_id id { - puts -nonewline "Redis $id" + puts -nonewline "KeyDB $id" set errcode [catch { set str {} append str "@[RI $id tcp_port]: " @@ -348,13 +348,13 @@ proc pause_on_error {} { } } } 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-keydb-logs \[N\] Show latest N lines of logs." puts "S cmd ... arg Call command in Sentinel ." - puts "R cmd ... arg Call command in Redis ." + puts "R cmd ... arg Call command in KeyDB ." puts "SI Show Sentinel INFO ." - puts "RI Show Redis INFO ." + puts "RI Show KeyDB INFO ." puts "continue Resume test." } else { set errcode [catch {eval $line} retval] diff --git a/tests/integration/redis-benchmark.tcl b/tests/integration/keydb-benchmark.tcl similarity index 100% rename from tests/integration/redis-benchmark.tcl rename to tests/integration/keydb-benchmark.tcl diff --git a/tests/integration/redis-cli.tcl b/tests/integration/keydb-cli.tcl similarity index 100% rename from tests/integration/redis-cli.tcl rename to tests/integration/keydb-cli.tcl diff --git a/tests/integration/logging.tcl b/tests/integration/logging.tcl index 742471e0b..048d873e6 100644 --- a/tests/integration/logging.tcl +++ b/tests/integration/logging.tcl @@ -1,12 +1,11 @@ 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 -set is_musl [catch {exec ldd --version}] set system_supported 0 # We only support darwin or Linux with glibc if {$system_name eq {darwin}} { 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 set ldd [exec ldd src/keydb-server] if {![string match {*libc.musl*} $ldd]} { diff --git a/tests/integration/psync2.tcl b/tests/integration/psync2.tcl index eccf6df2d..22ea65e56 100644 --- a/tests/integration/psync2.tcl +++ b/tests/integration/psync2.tcl @@ -5,7 +5,7 @@ proc show_cluster_status {} { # time info. Logs are in the following form: # # 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)} puts "Master ID is $master_id" diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index f942ec838..ec5e42815 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -57,8 +57,8 @@ set ::all_tests { integration/psync2-reg integration/psync2-pingoff integration/failover - integration/redis-cli - integration/redis-benchmark + integration/keydb-cli + integration/keydb-benchmark unit/pubsub unit/slowlog unit/scripting diff --git a/tests/unit/other.tcl b/tests/unit/other.tcl index 7502ed22b..9c2a70f05 100644 --- a/tests/unit/other.tcl +++ b/tests/unit/other.tcl @@ -62,57 +62,55 @@ start_server {overrides {save ""} tags {"other"}} { } {*index is out of range*} tags {consistency} { - if {true} { - if {$::accurate} {set numops 10000} else {set numops 1000} - test {Check consistency of different data types after a reload} { - r flushdb - createComplexDataset r $numops - set dump [csvdump r] - set sha1 [r debug digest] - r debug reload - set sha1_after [r debug digest] - if {$sha1 eq $sha1_after} { - set _ 1 - } else { - set newdump [csvdump r] - puts "Consistency test failed!" - puts "You can inspect the two dumps in /tmp/repldump*.txt" + if {$::accurate} {set numops 10000} else {set numops 1000} + test {Check consistency of different data types after a reload} { + r flushdb + createComplexDataset r $numops + set dump [csvdump r] + set sha1 [r debug digest] + r debug reload + set sha1_after [r debug digest] + if {$sha1 eq $sha1_after} { + set _ 1 + } else { + set newdump [csvdump r] + puts "Consistency test failed!" + puts "You can inspect the two dumps in /tmp/repldump*.txt" - set fd [open /tmp/repldump1.txt w] - puts $fd $dump - close $fd - set fd [open /tmp/repldump2.txt w] - puts $fd $newdump - close $fd + set fd [open /tmp/repldump1.txt w] + puts $fd $dump + close $fd + set fd [open /tmp/repldump2.txt w] + puts $fd $newdump + close $fd - set _ 0 - } - } {1} + set _ 0 + } + } {1} - test {Same dataset digest if saving/reloading as AOF?} { - r config set aof-use-rdb-preamble no - r bgrewriteaof - waitForBgrewriteaof r - r debug loadaof - set sha1_after [r debug digest] - if {$sha1 eq $sha1_after} { - set _ 1 - } else { - set newdump [csvdump r] - puts "Consistency test failed!" - puts "You can inspect the two dumps in /tmp/aofdump*.txt" + test {Same dataset digest if saving/reloading as AOF?} { + r config set aof-use-rdb-preamble no + r bgrewriteaof + waitForBgrewriteaof r + r debug loadaof + set sha1_after [r debug digest] + if {$sha1 eq $sha1_after} { + set _ 1 + } else { + set newdump [csvdump r] + puts "Consistency test failed!" + puts "You can inspect the two dumps in /tmp/aofdump*.txt" - set fd [open /tmp/aofdump1.txt w] - puts $fd $dump - close $fd - set fd [open /tmp/aofdump2.txt w] - puts $fd $newdump - close $fd + set fd [open /tmp/aofdump1.txt w] + puts $fd $dump + close $fd + set fd [open /tmp/aofdump2.txt w] + puts $fd $newdump + close $fd - set _ 0 - } - } {1} - } + set _ 0 + } + } {1} } test {EXPIRES after a reload (snapshot + append only file rewrite)} {