diff --git a/COPYING b/COPYING index a381681a1c..10928babb3 100644 --- a/COPYING +++ b/COPYING @@ -1,3 +1,18 @@ +# License 1 + +Copyright (c) 2024-present, Valkey contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# License 2 + Copyright (c) 2006-2020, Salvatore Sanfilippo All rights reserved. diff --git a/src/config.h b/src/config.h index dd741ac7ae..ff37991558 100644 --- a/src/config.h +++ b/src/config.h @@ -30,6 +30,8 @@ #ifndef CONFIG_H #define CONFIG_H +#include + #ifdef __APPLE__ #include // for fcntl(fd, F_FULLFSYNC) #include @@ -96,9 +98,11 @@ #endif /* Test for accept4() */ -#if defined(__linux__) || defined(OpenBSD5_7) || \ - (__FreeBSD__ >= 10 || __FreeBSD_version >= 1000000) || \ - (defined(NetBSD8_0) || __NetBSD_Version__ >= 800000000) +#if defined(__linux__) || \ + defined(__FreeBSD__) || \ + defined(OpenBSD5_7) || \ + (defined(__DragonFly__) && __DragonFly_version >= 400305) || \ + (defined(__NetBSD__) && (defined(NetBSD8_0) || __NetBSD_Version__ >= 800000000)) #define HAVE_ACCEPT4 1 #endif @@ -316,7 +320,7 @@ void setcpuaffinity(const char *cpulist); #endif /* Test for posix_fadvise() */ -#if defined(__linux__) || __FreeBSD__ >= 10 +#if defined(__linux__) || defined(__FreeBSD__) #define HAVE_FADVISE #endif diff --git a/src/dict.c b/src/dict.c index e3ba5189cd..8a9227629c 100644 --- a/src/dict.c +++ b/src/dict.c @@ -1809,7 +1809,7 @@ dictType BenchmarkDictType = { printf(msg ": %ld items in %lld ms\n", count, elapsed); \ } while(0) -/* ./redis-server test dict [ | --accurate] */ +/* ./valkey-server test dict [ | --accurate] */ int dictTest(int argc, char **argv, int flags) { long j; long long start, elapsed; diff --git a/src/kvstore.c b/src/kvstore.c index b3b166a0aa..2f954157b3 100644 --- a/src/kvstore.c +++ b/src/kvstore.c @@ -903,7 +903,7 @@ char *stringFromInt(int value) { return s; } -/* ./redis-server test kvstore */ +/* ./valkey-server test kvstore */ int kvstoreTest(int argc, char **argv, int flags) { UNUSED(argc); UNUSED(argv); diff --git a/src/server.c b/src/server.c index 3fbbd8cead..0864ec7d4c 100644 --- a/src/server.c +++ b/src/server.c @@ -7052,7 +7052,7 @@ int main(int argc, char **argv) { exit(0); } else { fprintf(stderr,"Please specify the amount of memory to test in megabytes.\n"); - fprintf(stderr,"Example: ./redis-server --test-memory 4096\n\n"); + fprintf(stderr,"Example: ./valkey-server --test-memory 4096\n\n"); exit(1); } } if (strcmp(argv[1], "--check-system") == 0) { diff --git a/src/syscheck.c b/src/syscheck.c index 008e28bbff..90689ba36c 100644 --- a/src/syscheck.c +++ b/src/syscheck.c @@ -127,7 +127,7 @@ int checkXenClocksource(sds *error_msg) { } else if (strcmp(curr, "xen") == 0) { *error_msg = sdsnew( "Your system is configured to use the 'xen' clocksource which might lead to degraded performance. " - "Check the result of the [slow-clocksource] system check: run 'redis-server --check-system' to check if " + "Check the result of the [slow-clocksource] system check: run 'valkey-server --check-system' to check if " "the system's clocksource isn't degrading performance."); res = -1; } @@ -180,10 +180,10 @@ int checkTHPEnabled(sds *error_msg) { if (strstr(buf,"[always]") != NULL) { *error_msg = sdsnew( "You have Transparent Huge Pages (THP) support enabled in your kernel. " - "This will create latency and memory usage issues with Redis. " + "This will create latency and memory usage issues with Valkey. " "To fix this issue run the command 'echo madvise > /sys/kernel/mm/transparent_hugepage/enabled' as root, " "and add it to your /etc/rc.local in order to retain the setting after a reboot. " - "Redis must be restarted after THP is disabled (set to 'madvise' or 'never')."); + "Valkey must be restarted after THP is disabled (set to 'madvise' or 'never')."); return -1; } else { return 1; diff --git a/src/tls.c b/src/tls.c index ad35ca2c2f..956b4b67c3 100644 --- a/src/tls.c +++ b/src/tls.c @@ -1177,7 +1177,7 @@ int ValkeyModule_OnLoad(void *ctx, ValkeyModuleString **argv, int argc) { /* Connection modules must be part of the same build as the server. */ if (strcmp(REDIS_BUILD_ID_RAW, serverBuildIdRaw())) { - serverLog(LL_NOTICE, "Connection type %s was not built together with the redis-server used.", CONN_TYPE_TLS); + serverLog(LL_NOTICE, "Connection type %s was not built together with the valkey-server used.", CONN_TYPE_TLS); return VALKEYMODULE_ERR; } diff --git a/src/ziplist.c b/src/ziplist.c index 677fe44233..413b7a8d25 100644 --- a/src/ziplist.c +++ b/src/ziplist.c @@ -1845,7 +1845,7 @@ static size_t strEntryBytesLarge(size_t slen) { return slen + zipStorePrevEntryLength(NULL, ZIP_BIG_PREVLEN) + zipStoreEntryEncoding(NULL, 0, slen); } -/* ./redis-server test ziplist */ +/* ./valkey-server test ziplist */ int ziplistTest(int argc, char **argv, int flags) { int accurate = (flags & TEST_ACCURATE); unsigned char *zl, *p; diff --git a/tests/README.md b/tests/README.md index 8165f832ca..9d9c657760 100644 --- a/tests/README.md +++ b/tests/README.md @@ -16,7 +16,7 @@ match different external server configurations: | `--singledb` | Only use database 0, don't assume others are supported. | | `--ignore-encoding` | Skip all checks for specific encoding. | | `--ignore-digest` | Skip key value digest validations. | -| `--cluster-mode` | Run in strict Redis Cluster compatibility mode. | +| `--cluster-mode` | Run in strict Valkey Cluster compatibility mode. | | `--large-memory` | Enables tests that consume more than 100mb | Tags diff --git a/tests/cluster/cluster.tcl b/tests/cluster/cluster.tcl index 3b99fe27de..0080501bf4 100644 --- a/tests/cluster/cluster.tcl +++ b/tests/cluster/cluster.tcl @@ -171,7 +171,7 @@ proc set_cluster_node_timeout {to} { proc cluster_write_test {id} { set prefix [randstring 20 20 alpha] set port [get_instance_attrib valkey $id port] - set cluster [redis_cluster 127.0.0.1:$port] + set cluster [valkey_cluster 127.0.0.1:$port] for {set j 0} {$j < 100} {incr j} { $cluster set key.$j $prefix.$j } diff --git a/tests/cluster/tests/03-failover-loop.tcl b/tests/cluster/tests/03-failover-loop.tcl index 548e15824d..5423349276 100644 --- a/tests/cluster/tests/03-failover-loop.tcl +++ b/tests/cluster/tests/03-failover-loop.tcl @@ -14,7 +14,7 @@ test "Cluster is up" { } set iterations 20 -set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] +set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] while {[incr iterations -1]} { set tokill [randomInt 10] diff --git a/tests/cluster/tests/04-resharding.tcl b/tests/cluster/tests/04-resharding.tcl index 5c289a238b..e063dc0694 100644 --- a/tests/cluster/tests/04-resharding.tcl +++ b/tests/cluster/tests/04-resharding.tcl @@ -55,11 +55,11 @@ proc process_is_running {pid} { set numkeys 50000 set numops 200000 set start_node_port [get_instance_attrib valkey 0 port] -set cluster [redis_cluster 127.0.0.1:$start_node_port] +set cluster [valkey_cluster 127.0.0.1:$start_node_port] if {$::tls} { # setup a non-TLS cluster client to the TLS cluster set plaintext_port [get_instance_attrib valkey 0 plaintext-port] - set cluster_plaintext [redis_cluster 127.0.0.1:$plaintext_port 0] + set cluster_plaintext [valkey_cluster 127.0.0.1:$plaintext_port 0] puts "Testing TLS cluster on start node 127.0.0.1:$start_node_port, plaintext port $plaintext_port" } else { set cluster_plaintext $cluster diff --git a/tests/cluster/tests/05-slave-selection.tcl b/tests/cluster/tests/05-slave-selection.tcl index 3cf1f1af35..bb3a06134e 100644 --- a/tests/cluster/tests/05-slave-selection.tcl +++ b/tests/cluster/tests/05-slave-selection.tcl @@ -48,7 +48,7 @@ test "Instance #5 and #10 synced with the master" { } } -set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] +set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] test "Slaves are both able to receive and acknowledge writes" { for {set j 0} {$j < 100} {incr j} { diff --git a/tests/cluster/tests/10-manual-failover.tcl b/tests/cluster/tests/10-manual-failover.tcl index 7f758f05be..4af4148cee 100644 --- a/tests/cluster/tests/10-manual-failover.tcl +++ b/tests/cluster/tests/10-manual-failover.tcl @@ -30,7 +30,7 @@ set current_epoch [CI 1 cluster_current_epoch] set numkeys 50000 set numops 10000 -set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] +set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] catch {unset content} array set content {} diff --git a/tests/cluster/tests/14-consistency-check.tcl b/tests/cluster/tests/14-consistency-check.tcl index 6a3c99eb7c..bc7c893214 100644 --- a/tests/cluster/tests/14-consistency-check.tcl +++ b/tests/cluster/tests/14-consistency-check.tcl @@ -38,7 +38,7 @@ proc get_one_of_my_replica {id} { proc cluster_write_keys_with_expire {id ttl} { set prefix [randstring 20 20 alpha] set port [get_instance_attrib valkey $id port] - set cluster [redis_cluster 127.0.0.1:$port] + set cluster [valkey_cluster 127.0.0.1:$port] for {set j 100} {$j < 200} {incr j} { $cluster setex key_expire.$j $ttl $prefix.$j } diff --git a/tests/cluster/tests/15-cluster-slots.tcl b/tests/cluster/tests/15-cluster-slots.tcl index 096f54f9f8..927c1ff0dd 100644 --- a/tests/cluster/tests/15-cluster-slots.tcl +++ b/tests/cluster/tests/15-cluster-slots.tcl @@ -44,13 +44,13 @@ test "client do not break when cluster slot" { } test "client can handle keys with hash tag" { - set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] + set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] $cluster set foo{tag} bar $cluster close } test "slot migration is valid from primary to another primary" { - set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] + set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] set key order1 set slot [$cluster cluster keyslot $key] array set nodefrom [$cluster masternode_for_slot $slot] @@ -61,7 +61,7 @@ test "slot migration is valid from primary to another primary" { } test "slot migration is invalid from primary to replica" { - set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] + set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] set key order1 set slot [$cluster cluster keyslot $key] array set nodefrom [$cluster masternode_for_slot $slot] diff --git a/tests/cluster/tests/20-half-migrated-slot.tcl b/tests/cluster/tests/20-half-migrated-slot.tcl index 529823b119..8049ca1be4 100644 --- a/tests/cluster/tests/20-half-migrated-slot.tcl +++ b/tests/cluster/tests/20-half-migrated-slot.tcl @@ -21,7 +21,7 @@ test "Cluster is up" { assert_cluster_state ok } -set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] +set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] catch {unset nodefrom} catch {unset nodeto} diff --git a/tests/cluster/tests/21-many-slot-migration.tcl b/tests/cluster/tests/21-many-slot-migration.tcl index 7d447653f5..703cf58614 100644 --- a/tests/cluster/tests/21-many-slot-migration.tcl +++ b/tests/cluster/tests/21-many-slot-migration.tcl @@ -21,7 +21,7 @@ test "Cluster is up" { assert_cluster_state ok } -set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] +set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] catch {unset nodefrom} catch {unset nodeto} diff --git a/tests/cluster/tests/25-pubsubshard-slot-migration.tcl b/tests/cluster/tests/25-pubsubshard-slot-migration.tcl index 98baa3a3db..45ec500eb7 100644 --- a/tests/cluster/tests/25-pubsubshard-slot-migration.tcl +++ b/tests/cluster/tests/25-pubsubshard-slot-migration.tcl @@ -8,10 +8,10 @@ test "Cluster is up" { assert_cluster_state ok } -set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] +set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] proc get_addr_replica_serving_slot slot { - set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] + set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] array set node [$cluster masternode_for_slot $slot] set replicanodeinfo [$cluster cluster replicas $node(id)] diff --git a/tests/cluster/tests/26-pubsubshard.tcl b/tests/cluster/tests/26-pubsubshard.tcl index 77ed52006e..fe0e7d39ab 100644 --- a/tests/cluster/tests/26-pubsubshard.tcl +++ b/tests/cluster/tests/26-pubsubshard.tcl @@ -6,7 +6,7 @@ test "Create a 3 nodes cluster" { cluster_create_with_continuous_slots 3 3 } -set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] +set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] test "Pub/Sub shard basics" { set slot [$cluster cluster keyslot "channel.0"] diff --git a/tests/cluster/tests/29-slot-migration-response.tcl b/tests/cluster/tests/29-slot-migration-response.tcl index 75be29e970..bc76735591 100644 --- a/tests/cluster/tests/29-slot-migration-response.tcl +++ b/tests/cluster/tests/29-slot-migration-response.tcl @@ -12,7 +12,7 @@ test "Cluster is up" { assert_cluster_state ok } -set cluster [redis_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] +set cluster [valkey_cluster 127.0.0.1:[get_instance_attrib valkey 0 port]] catch {unset nodefrom} catch {unset nodeto} diff --git a/tests/cluster/tests/includes/utils.tcl b/tests/cluster/tests/includes/utils.tcl index 84a6255766..9182b984cc 100644 --- a/tests/cluster/tests/includes/utils.tcl +++ b/tests/cluster/tests/includes/utils.tcl @@ -11,7 +11,7 @@ proc fix_cluster {addr} { exec ../../../src/valkey-cli {*}[valkeycli_tls_config "../../../tests"] --cluster fix $addr << yes } result] if {$code != 0} { - puts "redis-cli --cluster fix returns non-zero exit code, output below:\n$result" + puts "valkey-cli --cluster fix returns non-zero exit code, output below:\n$result" } # Note: valkey-cli --cluster fix may return a non-zero exit code if nodes don't agree, # but we can ignore that and rely on the check below. @@ -19,7 +19,7 @@ proc fix_cluster {addr} { wait_for_condition 100 100 { [catch {exec ../../../src/valkey-cli {*}[valkeycli_tls_config "../../../tests"] --cluster check $addr} result] == 0 } else { - puts "redis-cli --cluster check returns non-zero exit code, output below:\n$result" + puts "valkey-cli --cluster check returns non-zero exit code, output below:\n$result" fail "Cluster could not settle with configuration" } } diff --git a/tests/helpers/bg_block_op.tcl b/tests/helpers/bg_block_op.tcl index eb02b12273..094397225f 100644 --- a/tests/helpers/bg_block_op.tcl +++ b/tests/helpers/bg_block_op.tcl @@ -1,4 +1,4 @@ -source tests/support/redis.tcl +source tests/support/valkey.tcl source tests/support/util.tcl set ::tlsdir "tests/tls" diff --git a/tests/helpers/bg_complex_data.tcl b/tests/helpers/bg_complex_data.tcl index fc4bf4237f..6bc5c59598 100644 --- a/tests/helpers/bg_complex_data.tcl +++ b/tests/helpers/bg_complex_data.tcl @@ -1,4 +1,4 @@ -source tests/support/redis.tcl +source tests/support/valkey.tcl source tests/support/util.tcl set ::tlsdir "tests/tls" diff --git a/tests/helpers/gen_write_load.tcl b/tests/helpers/gen_write_load.tcl index a5da6d9f4a..9a148b73cc 100644 --- a/tests/helpers/gen_write_load.tcl +++ b/tests/helpers/gen_write_load.tcl @@ -1,4 +1,4 @@ -source tests/support/redis.tcl +source tests/support/valkey.tcl set ::tlsdir "tests/tls" diff --git a/tests/instances.tcl b/tests/instances.tcl index 8b5c3ecaff..5b90a60093 100644 --- a/tests/instances.tcl +++ b/tests/instances.tcl @@ -10,7 +10,7 @@ package require Tcl 8.5 set tcl_precision 17 -source ../support/redis.tcl +source ../support/valkey.tcl source ../support/util.tcl source ../support/aofmanifest.tcl source ../support/server.tcl @@ -40,7 +40,7 @@ set ::loop 0 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 Valkey source root." exit 1 } @@ -313,7 +313,7 @@ proc parse_options {} { puts "--fail Simulate a test failure." puts "--valgrind Run with valgrind." puts "--tls Run tests in TLS mode." - puts "--tls-module Run tests in TLS mode with Redis module." + puts "--tls-module Run tests in TLS mode with Valkey module." puts "--host Use hostname instead of 127.0.0.1." puts "--config Extra config argument(s)." puts "--stop Blocks once the first test fails." @@ -342,12 +342,12 @@ proc pause_on_error {} { set cmd [lindex $argv 0] if {$cmd eq {continue}} { break - } elseif {$cmd eq {show-redis-logs}} { + } elseif {$cmd eq {show-valkey-logs}} { set count 10 if {[lindex $argv 1] ne {}} {set count [lindex $argv 1]} foreach_valkey_id id { - puts "=== REDIS $id ====" - puts [exec tail -$count redis_$id/log.txt] + puts "=== VALKEY $id ====" + puts [exec tail -$count valkey_$id/log.txt] puts "---------------------\n" } } elseif {$cmd eq {show-sentinel-logs}} { @@ -360,7 +360,7 @@ proc pause_on_error {} { } } elseif {$cmd eq {ls}} { foreach_valkey_id id { - puts -nonewline "Redis $id" + puts -nonewline "Valkey $id" set errcode [catch { set str {} append str "@[RI $id tcp_port]: " @@ -391,13 +391,13 @@ proc pause_on_error {} { } } } elseif {$cmd eq {help}} { - puts "ls List Sentinel and Redis instances." + puts "ls List Sentinel and Valkey instances." puts "show-sentinel-logs \[N\] Show latest N lines of logs." - puts "show-redis-logs \[N\] Show latest N lines of logs." + puts "show-valkey-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 Valkey ." puts "SI Show Sentinel INFO ." - puts "RI Show Redis INFO ." + puts "RI Show Valkey INFO ." puts "continue Resume test." } else { set errcode [catch {eval $line} retval] diff --git a/tests/integration/aof-multi-part.tcl b/tests/integration/aof-multi-part.tcl index ac4a637665..977bb11e4c 100644 --- a/tests/integration/aof-multi-part.tcl +++ b/tests/integration/aof-multi-part.tcl @@ -604,71 +604,71 @@ tags {"external:skip"} { } start_server_aof [list dir $server_path] { - set redis1 [valkey [srv host] [srv port] 0 $::tls] + set valkey1 [valkey [srv host] [srv port] 0 $::tls] start_server [list overrides [list dir $server_path appendonly yes appendfilename appendonly.aof2]] { - set redis2 [valkey [srv host] [srv port] 0 $::tls] + set valkey2 [valkey [srv host] [srv port] 0 $::tls] test "Multi Part AOF can upgrade when when two servers share the same server dir (server1)" { - wait_done_loading $redis1 - assert_equal v1 [$redis1 get k1] - assert_equal v2 [$redis1 get k2] - assert_equal v3 [$redis1 get k3] + wait_done_loading $valkey1 + assert_equal v1 [$valkey1 get k1] + assert_equal v2 [$valkey1 get k2] + assert_equal v3 [$valkey1 get k3] - assert_equal 0 [$redis1 exists k4] - assert_equal 0 [$redis1 exists k5] - assert_equal 0 [$redis1 exists k6] + assert_equal 0 [$valkey1 exists k4] + assert_equal 0 [$valkey1 exists k5] + assert_equal 0 [$valkey1 exists k6] assert_aof_manifest_content $aof_manifest_file { {file appendonly.aof seq 1 type b} {file appendonly.aof.1.incr.aof seq 1 type i} } - $redis1 bgrewriteaof - waitForBgrewriteaof $redis1 + $valkey1 bgrewriteaof + waitForBgrewriteaof $valkey1 - assert_equal OK [$redis1 set k v] + assert_equal OK [$valkey1 set k v] assert_aof_manifest_content $aof_manifest_file { {file appendonly.aof.2.base.rdb seq 2 type b} {file appendonly.aof.2.incr.aof seq 2 type i} } - set d1 [$redis1 debug digest] - $redis1 debug loadaof - set d2 [$redis1 debug digest] + set d1 [$valkey1 debug digest] + $valkey1 debug loadaof + set d2 [$valkey1 debug digest] assert {$d1 eq $d2} } test "Multi Part AOF can upgrade when when two servers share the same server dir (server2)" { - wait_done_loading $redis2 + wait_done_loading $valkey2 - assert_equal 0 [$redis2 exists k1] - assert_equal 0 [$redis2 exists k2] - assert_equal 0 [$redis2 exists k3] + assert_equal 0 [$valkey2 exists k1] + assert_equal 0 [$valkey2 exists k2] + assert_equal 0 [$valkey2 exists k3] - assert_equal v4 [$redis2 get k4] - assert_equal v5 [$redis2 get k5] - assert_equal v6 [$redis2 get k6] + assert_equal v4 [$valkey2 get k4] + assert_equal v5 [$valkey2 get k5] + assert_equal v6 [$valkey2 get k6] assert_aof_manifest_content $aof_manifest_file2 { {file appendonly.aof2 seq 1 type b} {file appendonly.aof2.1.incr.aof seq 1 type i} } - $redis2 bgrewriteaof - waitForBgrewriteaof $redis2 + $valkey2 bgrewriteaof + waitForBgrewriteaof $valkey2 - assert_equal OK [$redis2 set k v] + assert_equal OK [$valkey2 set k v] assert_aof_manifest_content $aof_manifest_file2 { {file appendonly.aof2.2.base.rdb seq 2 type b} {file appendonly.aof2.2.incr.aof seq 2 type i} } - set d1 [$redis2 debug digest] - $redis2 debug loadaof - set d2 [$redis2 debug digest] + set d1 [$valkey2 debug digest] + $valkey2 debug loadaof + set d2 [$valkey2 debug digest] assert {$d1 eq $d2} } } @@ -677,7 +677,7 @@ tags {"external:skip"} { test {Multi Part AOF can handle appendfilename contains whitespaces} { start_server [list overrides [list appendonly yes appendfilename "\" file seq \\n\\n.aof \""]] { - set dir [get_redis_dir] + set dir [get_valkey_dir] set aof_manifest_name [format "%s/%s/%s%s" $dir "appendonlydir" " file seq \n\n.aof " $::manifest_suffix] set valkey [valkey [srv host] [srv port] 0 $::tls] @@ -756,7 +756,7 @@ tags {"external:skip"} { start_server {tags {"Multi Part AOF"} overrides {aof-use-rdb-preamble {yes} appendonly {no} save {}}} { - set dir [get_redis_dir] + set dir [get_valkey_dir] set aof_basename "appendonly.aof" set aof_dirname "appendonlydir" set aof_dirpath "$dir/$aof_dirname" @@ -1174,7 +1174,7 @@ tags {"external:skip"} { } start_server {overrides {aof-use-rdb-preamble {yes} appendonly {no} save {}}} { - set dir [get_redis_dir] + set dir [get_valkey_dir] set aof_basename "appendonly.aof" set aof_dirname "appendonlydir" set aof_dirpath "$dir/$aof_dirname" diff --git a/tests/integration/valkey-cli.tcl b/tests/integration/valkey-cli.tcl index c3497d95b9..066a70a6a8 100644 --- a/tests/integration/valkey-cli.tcl +++ b/tests/integration/valkey-cli.tcl @@ -375,7 +375,7 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS [catch {close [socket "127.0.0.1" $port1]}] == 0 && \ [catch {close [socket "127.0.0.1" $port2]}] == 0 } else { - fail "Failed to start fake Redis nodes" + fail "Failed to start fake Valkey nodes" } # Run the cli assert_equal "OK" [run_cli_host_port_db "127.0.0.1" $port1 0 -c SET foo bar] @@ -444,7 +444,7 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS r acl deluser clitest } - proc test_redis_cli_rdb_dump {functions_only} { + proc test_valkey_cli_rdb_dump {functions_only} { r flushdb r function flush @@ -480,12 +480,12 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS test "Dumping an RDB - functions only: $functions_only" { # Disk-based master assert_match "OK" [r config set repl-diskless-sync no] - test_redis_cli_rdb_dump $functions_only + test_valkey_cli_rdb_dump $functions_only # Disk-less master assert_match "OK" [r config set repl-diskless-sync yes] assert_match "OK" [r config set repl-diskless-sync-delay 0] - test_redis_cli_rdb_dump $functions_only + test_valkey_cli_rdb_dump $functions_only } {} {needs:repl needs:debug} } ;# foreach functions_only @@ -504,12 +504,12 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS assert_equal {key:2} [run_cli --scan --quoted-pattern {"*:\x32"}] } - proc test_redis_cli_repl {} { + proc test_valkey_cli_repl {} { set fd [open_cli "--replica"] wait_for_condition 500 100 { [string match {*slave0:*state=online*} [r info]] } else { - fail "redis-cli --replica did not connect" + fail "valkey-cli --replica did not connect" } for {set i 0} {$i < 100} {incr i} { @@ -519,7 +519,7 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS wait_for_condition 500 100 { [string match {*test-value-99*} [read_cli $fd]] } else { - fail "redis-cli --replica didn't read commands" + fail "valkey-cli --replica didn't read commands" } fconfigure $fd -blocking true @@ -531,12 +531,12 @@ if {!$::tls} { ;# fake_redis_node doesn't support TLS test "Connecting as a replica" { # Disk-based master assert_match "OK" [r config set repl-diskless-sync no] - test_redis_cli_repl + test_valkey_cli_repl # Disk-less master assert_match "OK" [r config set repl-diskless-sync yes] assert_match "OK" [r config set repl-diskless-sync-delay 0] - test_redis_cli_repl + test_valkey_cli_repl } {} {needs:repl} test "Piping raw protocol" { diff --git a/tests/sentinel/tests/00-base.tcl b/tests/sentinel/tests/00-base.tcl index 274a84316a..ee88469ec3 100644 --- a/tests/sentinel/tests/00-base.tcl +++ b/tests/sentinel/tests/00-base.tcl @@ -104,7 +104,7 @@ test "All the other slaves now point to the new master" { wait_for_condition 1000 50 { [RI $id master_port] == [lindex $addr 1] } else { - fail "Redis ID $id not configured to replicate with new master" + fail "Valkey ID $id not configured to replicate with new master" } } } diff --git a/tests/sentinel/tests/02-slaves-reconf.tcl b/tests/sentinel/tests/02-slaves-reconf.tcl index 5bbd80feca..32e18d0eb2 100644 --- a/tests/sentinel/tests/02-slaves-reconf.tcl +++ b/tests/sentinel/tests/02-slaves-reconf.tcl @@ -18,7 +18,7 @@ proc 02_test_slaves_replication {} { ([RI $id master_port] == $master_port) && ([RI $id master_link_status] eq {up}) } else { - fail "Redis slave $id is replicating from wrong master" + fail "Valkey slave $id is replicating from wrong master" } } } diff --git a/tests/sentinel/tests/05-manual.tcl b/tests/sentinel/tests/05-manual.tcl index f3cfb1e3a2..1834085645 100644 --- a/tests/sentinel/tests/05-manual.tcl +++ b/tests/sentinel/tests/05-manual.tcl @@ -48,7 +48,7 @@ test "All the other slaves now point to the new master" { wait_for_condition 1000 50 { [RI $id master_port] == [lindex $addr 1] } else { - fail "Redis ID $id not configured to replicate with new master" + fail "Valkey ID $id not configured to replicate with new master" } } } diff --git a/tests/sentinel/tests/12-master-reboot.tcl b/tests/sentinel/tests/12-master-reboot.tcl index df6ff49b7c..ad536f7e37 100644 --- a/tests/sentinel/tests/12-master-reboot.tcl +++ b/tests/sentinel/tests/12-master-reboot.tcl @@ -88,7 +88,7 @@ test "All the other slaves now point to the new master" { wait_for_condition 1000 50 { [RI $id master_port] == [lindex $addr 1] } else { - fail "Redis ID $id not configured to replicate with new master" + fail "Valkey ID $id not configured to replicate with new master" } } } diff --git a/tests/support/aofmanifest.tcl b/tests/support/aofmanifest.tcl index 151626294f..308d1172aa 100644 --- a/tests/support/aofmanifest.tcl +++ b/tests/support/aofmanifest.tcl @@ -12,7 +12,7 @@ proc join_path {dir1 dir2} { return [format "%s/%s" $dir1 $dir2] } -proc get_redis_dir {} { +proc get_valkey_dir {} { set config [srv config] set _ [dict get $config "dir"] } diff --git a/tests/support/cluster.tcl b/tests/support/cluster.tcl index 59f6767b88..2b9e44f64f 100644 --- a/tests/support/cluster.tcl +++ b/tests/support/cluster.tcl @@ -4,25 +4,25 @@ # # Example usage: # -# set c [redis_cluster {127.0.0.1:6379 127.0.0.1:6380}] +# set c [valkey_cluster {127.0.0.1:6379 127.0.0.1:6380}] # $c set foo # $c get foo # $c close package require Tcl 8.5 -package provide redis_cluster 0.1 +package provide valkey_cluster 0.1 -namespace eval redis_cluster {} -set ::redis_cluster::internal_id 0 -set ::redis_cluster::id 0 -array set ::redis_cluster::startup_nodes {} -array set ::redis_cluster::nodes {} -array set ::redis_cluster::slots {} -array set ::redis_cluster::tls {} +namespace eval valkey_cluster {} +set ::valkey_cluster::internal_id 0 +set ::valkey_cluster::id 0 +array set ::valkey_cluster::startup_nodes {} +array set ::valkey_cluster::nodes {} +array set ::valkey_cluster::slots {} +array set ::valkey_cluster::tls {} # List of "plain" commands, which are commands where the sole key is always # the first argument. -set ::redis_cluster::plain_commands { +set ::valkey_cluster::plain_commands { get set setnx setex psetex append strlen exists setbit getbit setrange getrange substr incr decr rpush lpush rpushx lpushx linsert rpop lpop brpop llen lindex lset lrange ltrim lrem @@ -39,34 +39,34 @@ set ::redis_cluster::plain_commands { # Create a cluster client. The nodes are given as a list of host:port. The TLS # parameter (1 or 0) is optional and defaults to the global $::tls. -proc redis_cluster {nodes {tls -1}} { - set id [incr ::redis_cluster::id] - set ::redis_cluster::startup_nodes($id) $nodes - set ::redis_cluster::nodes($id) {} - set ::redis_cluster::slots($id) {} - set ::redis_cluster::tls($id) [expr $tls == -1 ? $::tls : $tls] - set handle [interp alias {} ::redis_cluster::instance$id {} ::redis_cluster::__dispatch__ $id] +proc valkey_cluster {nodes {tls -1}} { + set id [incr ::valkey_cluster::id] + set ::valkey_cluster::startup_nodes($id) $nodes + set ::valkey_cluster::nodes($id) {} + set ::valkey_cluster::slots($id) {} + set ::valkey_cluster::tls($id) [expr $tls == -1 ? $::tls : $tls] + set handle [interp alias {} ::valkey_cluster::instance$id {} ::valkey_cluster::__dispatch__ $id] $handle refresh_nodes_map return $handle } # Totally reset the slots / nodes state for the client, calls # CLUSTER NODES in the first startup node available, populates the -# list of nodes ::redis_cluster::nodes($id) with an hash mapping node +# list of nodes ::valkey_cluster::nodes($id) with an hash mapping node # ip:port to a representation of the node (another hash), and finally -# maps ::redis_cluster::slots($id) with an hash mapping slot numbers +# maps ::valkey_cluster::slots($id) with an hash mapping slot numbers # to node IDs. # # This function is called when a new Cluster client is initialized # and every time we get a -MOVED redirection error. -proc ::redis_cluster::__method__refresh_nodes_map {id} { +proc ::valkey_cluster::__method__refresh_nodes_map {id} { # Contact the first responding startup node. set idx 0; # Index of the node that will respond. set errmsg {} - foreach start_node $::redis_cluster::startup_nodes($id) { + foreach start_node $::valkey_cluster::startup_nodes($id) { set ip_port [lindex [split $start_node @] 0] lassign [split $ip_port :] start_host start_port - set tls $::redis_cluster::tls($id) + set tls $::valkey_cluster::tls($id) if {[catch { set r {} set r [valkey $start_host $start_port 0 $tls] @@ -84,18 +84,18 @@ proc ::redis_cluster::__method__refresh_nodes_map {id} { } } - if {$idx == [llength $::redis_cluster::startup_nodes($id)]} { + if {$idx == [llength $::valkey_cluster::startup_nodes($id)]} { error "No good startup node found. $errmsg" } # Put the node that responded as first in the list if it is not # already the first. if {$idx != 0} { - set l $::redis_cluster::startup_nodes($id) + set l $::valkey_cluster::startup_nodes($id) set left [lrange $l 0 [expr {$idx-1}]] set right [lrange $l [expr {$idx+1}] end] set l [concat [lindex $l $idx] $left $right] - set ::redis_cluster::startup_nodes($id) $l + set ::valkey_cluster::startup_nodes($id) $l } # Parse CLUSTER NODES output to populate the nodes description. @@ -114,7 +114,7 @@ proc ::redis_cluster::__method__refresh_nodes_map {id} { # Connect to the node set link {} - set tls $::redis_cluster::tls($id) + set tls $::valkey_cluster::tls($id) catch {set link [valkey $host $port 0 $tls]} # Build this node description as an hash. @@ -130,17 +130,17 @@ proc ::redis_cluster::__method__refresh_nodes_map {id} { link $link \ ] dict set nodes $addr $node - lappend ::redis_cluster::startup_nodes($id) $addr + lappend ::valkey_cluster::startup_nodes($id) $addr } # Close all the existing links in the old nodes map, and set the new # map as current. - foreach n $::redis_cluster::nodes($id) { + foreach n $::valkey_cluster::nodes($id) { catch { [dict get $n link] close } } - set ::redis_cluster::nodes($id) $nodes + set ::valkey_cluster::nodes($id) $nodes # Populates the slots -> nodes map. dict for {addr node} $nodes { @@ -148,47 +148,47 @@ proc ::redis_cluster::__method__refresh_nodes_map {id} { lassign [split $slotrange -] start end if {$end == {}} {set end $start} for {set j $start} {$j <= $end} {incr j} { - dict set ::redis_cluster::slots($id) $j $addr + dict set ::valkey_cluster::slots($id) $j $addr } } } # Only retain unique entries in the startup nodes list - set ::redis_cluster::startup_nodes($id) [lsort -unique $::redis_cluster::startup_nodes($id)] + set ::valkey_cluster::startup_nodes($id) [lsort -unique $::valkey_cluster::startup_nodes($id)] } -# Free a redis_cluster handle. -proc ::redis_cluster::__method__close {id} { +# Free a valkey_cluster handle. +proc ::valkey_cluster::__method__close {id} { catch { - set nodes $::redis_cluster::nodes($id) + set nodes $::valkey_cluster::nodes($id) dict for {addr node} $nodes { catch { [dict get $node link] close } } } - catch {unset ::redis_cluster::startup_nodes($id)} - catch {unset ::redis_cluster::nodes($id)} - catch {unset ::redis_cluster::slots($id)} - catch {unset ::redis_cluster::tls($id)} - catch {interp alias {} ::redis_cluster::instance$id {}} + catch {unset ::valkey_cluster::startup_nodes($id)} + catch {unset ::valkey_cluster::nodes($id)} + catch {unset ::valkey_cluster::slots($id)} + catch {unset ::valkey_cluster::tls($id)} + catch {interp alias {} ::valkey_cluster::instance$id {}} } -proc ::redis_cluster::__method__masternode_for_slot {id slot} { +proc ::valkey_cluster::__method__masternode_for_slot {id slot} { # Get the node mapped to this slot. - set node_addr [dict get $::redis_cluster::slots($id) $slot] + set node_addr [dict get $::valkey_cluster::slots($id) $slot] if {$node_addr eq {}} { error "No mapped node for slot $slot." } - return [dict get $::redis_cluster::nodes($id) $node_addr] + return [dict get $::valkey_cluster::nodes($id) $node_addr] } -proc ::redis_cluster::__method__masternode_notfor_slot {id slot} { +proc ::valkey_cluster::__method__masternode_notfor_slot {id slot} { # Get a node that is not mapped to this slot. - set node_addr [dict get $::redis_cluster::slots($id) $slot] - set addrs [dict keys $::redis_cluster::nodes($id)] + set node_addr [dict get $::valkey_cluster::slots($id) $slot] + set addrs [dict keys $::valkey_cluster::nodes($id)] foreach addr [lshuffle $addrs] { - set node [dict get $::redis_cluster::nodes($id) $addr] + set node [dict get $::valkey_cluster::nodes($id) $addr] if {$node_addr ne $addr && [dict get $node slaveof] eq "-"} { return $node } @@ -196,22 +196,22 @@ proc ::redis_cluster::__method__masternode_notfor_slot {id slot} { error "Slot $slot is everywhere" } -proc ::redis_cluster::__dispatch__ {id method args} { - if {[info command ::redis_cluster::__method__$method] eq {}} { +proc ::valkey_cluster::__dispatch__ {id method args} { + if {[info command ::valkey_cluster::__method__$method] eq {}} { # Get the keys from the command. - set keys [::redis_cluster::get_keys_from_command $method $args] + set keys [::valkey_cluster::get_keys_from_command $method $args] if {$keys eq {}} { - error "Redis command '$method' is not supported by redis_cluster." + error "Valkey command '$method' is not supported by valkey_cluster." } # Resolve the keys in the corresponding hash slot they hash to. - set slot [::redis_cluster::get_slot_from_keys $keys] + set slot [::valkey_cluster::get_slot_from_keys $keys] if {$slot eq {}} { error "Invalid command: multiple keys not hashing to the same slot." } # Get the node mapped to this slot. - set node_addr [dict get $::redis_cluster::slots($id) $slot] + set node_addr [dict get $::valkey_cluster::slots($id) $slot] if {$node_addr eq {}} { error "No mapped node for slot $slot." } @@ -221,7 +221,7 @@ proc ::redis_cluster::__dispatch__ {id method args} { set asking 0 while {[incr retry -1]} { if {$retry < 5} {after 100} - set node [dict get $::redis_cluster::nodes($id) $node_addr] + set node [dict get $::valkey_cluster::nodes($id) $node_addr] set link [dict get $node link] if {$asking} { $link ASKING @@ -233,8 +233,8 @@ proc ::redis_cluster::__dispatch__ {id method args} { [string range $e 0 2] eq {I/O} \ } { # MOVED redirection. - ::redis_cluster::__method__refresh_nodes_map $id - set node_addr [dict get $::redis_cluster::slots($id) $slot] + ::valkey_cluster::__method__refresh_nodes_map $id + set node_addr [dict get $::valkey_cluster::slots($id) $slot] continue } elseif {[string range $e 0 2] eq {ASK}} { # ASK redirection. @@ -250,16 +250,16 @@ proc ::redis_cluster::__dispatch__ {id method args} { return $e } } - error "Too many redirections or failures contacting Redis Cluster." + error "Too many redirections or failures contacting Valkey Cluster." } else { - uplevel 1 [list ::redis_cluster::__method__$method $id] $args + uplevel 1 [list ::valkey_cluster::__method__$method $id] $args } } -proc ::redis_cluster::get_keys_from_command {cmd argv} { +proc ::valkey_cluster::get_keys_from_command {cmd argv} { set cmd [string tolower $cmd] # Most commands get just one key as first argument. - if {[lsearch -exact $::redis_cluster::plain_commands $cmd] != -1} { + if {[lsearch -exact $::valkey_cluster::plain_commands $cmd] != -1} { return [list [lindex $argv 0]] } @@ -277,7 +277,7 @@ proc ::redis_cluster::get_keys_from_command {cmd argv} { # Returns the CRC16 of the specified string. # The CRC parameters are described in the Cluster specification. -set ::redis_cluster::XMODEMCRC16Lookup { +set ::valkey_cluster::XMODEMCRC16Lookup { 0x0000 0x1021 0x2042 0x3063 0x4084 0x50a5 0x60c6 0x70e7 0x8108 0x9129 0xa14a 0xb16b 0xc18c 0xd1ad 0xe1ce 0xf1ef 0x1231 0x0210 0x3273 0x2252 0x52b5 0x4294 0x72f7 0x62d6 @@ -312,19 +312,19 @@ set ::redis_cluster::XMODEMCRC16Lookup { 0x6e17 0x7e36 0x4e55 0x5e74 0x2e93 0x3eb2 0x0ed1 0x1ef0 } -proc ::redis_cluster::crc16 {s} { +proc ::valkey_cluster::crc16 {s} { set s [encoding convertto ascii $s] set crc 0 foreach char [split $s {}] { scan $char %c byte - set crc [expr {(($crc<<8)&0xffff) ^ [lindex $::redis_cluster::XMODEMCRC16Lookup [expr {(($crc>>8)^$byte) & 0xff}]]}] + set crc [expr {(($crc<<8)&0xffff) ^ [lindex $::valkey_cluster::XMODEMCRC16Lookup [expr {(($crc>>8)^$byte) & 0xff}]]}] } return $crc } # Hash a single key returning the slot it belongs to, Implemented hash # tags as described in the Cluster specification. -proc ::redis_cluster::hash {key} { +proc ::valkey_cluster::hash {key} { set keylen [string length $key] set s {} set e {} @@ -353,10 +353,10 @@ proc ::redis_cluster::hash {key} { # Return the slot the specified keys hash to. # If the keys hash to multiple slots, an empty string is returned to # signal that the command can't be run in Cluster. -proc ::redis_cluster::get_slot_from_keys {keys} { +proc ::valkey_cluster::get_slot_from_keys {keys} { set slot {} foreach k $keys { - set s [::redis_cluster::hash $k] + set s [::valkey_cluster::hash $k] if {$slot eq {}} { set slot $s } elseif {$slot != $s} { diff --git a/tests/support/server.tcl b/tests/support/server.tcl index 813f240bf1..ddcdbcddbc 100644 --- a/tests/support/server.tcl +++ b/tests/support/server.tcl @@ -4,7 +4,7 @@ set ::valgrind_errors {} proc start_server_error {config_file error} { set err {} - append err "Can't start the Redis server\n" + append err "Can't start the Valkey server\n" append err "CONFIGURATION:\n" append err [exec cat $config_file] append err "\nERROR:\n" diff --git a/tests/support/test.tcl b/tests/support/test.tcl index 3f2200b114..9c959d9de7 100644 --- a/tests/support/test.tcl +++ b/tests/support/test.tcl @@ -258,7 +258,7 @@ proc test {name code {okpattern undefined} {tags {}}} { } if {$::traceleaks} { - set output [exec leaks redis-server] + set output [exec leaks valkey-server] if {![string match {*0 leaks*} $output]} { send_data_packet $::test_server_fd err "Detected a memory leak in test '$name': $output" } diff --git a/tests/support/redis.tcl b/tests/support/valkey.tcl similarity index 80% rename from tests/support/redis.tcl rename to tests/support/valkey.tcl index 4050d4065a..6f8727ace8 100644 --- a/tests/support/redis.tcl +++ b/tests/support/valkey.tcl @@ -19,7 +19,7 @@ # } # } # -# set r [redis] +# set r [valkey] # $r blocking 0 # $r get fo [list handlePong] # @@ -72,13 +72,13 @@ proc valkey {{server 127.0.0.1} {port 6379} {defer 0} {tls 0} {tlsoptions {}} {r set ::valkey::curr_argv($id) 0 set ::valkey::testing_resp3($id) 0 set ::valkey::tls($id) $tls - ::valkey::redis_reset_state $id - interp alias {} ::valkey::redisHandle$id {} ::valkey::__dispatch__ $id + ::valkey::valkey_reset_state $id + interp alias {} ::valkey::valkeyHandle$id {} ::valkey::__dispatch__ $id } # On recent versions of tcl-tls/OpenSSL, reading from a dropped connection # results with an error we need to catch and mimic the old behavior. -proc ::valkey::redis_safe_read {fd len} { +proc ::valkey::valkey_safe_read {fd len} { if {$len == -1} { set err [catch {set val [read $fd]} msg] } else { @@ -93,7 +93,7 @@ proc ::valkey::redis_safe_read {fd len} { error $msg } -proc ::valkey::redis_safe_gets {fd} { +proc ::valkey::valkey_safe_gets {fd} { if {[catch {set val [gets $fd]} msg]} { if {[string match "*connection abort*" $msg]} { return {} @@ -162,7 +162,7 @@ proc ::valkey::__dispatch__raw__ {id method argv} { foreach a $argv { append cmd "$[string length $a]\r\n$a\r\n" } - ::valkey::redis_write $fd $cmd + ::valkey::valkey_write $fd $cmd if {[catch {flush $fd}]} { catch {close $fd} set ::valkey::fd($id) {} @@ -172,13 +172,13 @@ proc ::valkey::__dispatch__raw__ {id method argv} { set ::valkey::curr_argv($id) [concat $method $argv] if {!$deferred} { if {$blocking} { - ::valkey::redis_read_reply $id $fd + ::valkey::valkey_read_reply $id $fd } else { # Every well formed reply read will pop an element from this # list and use it as a callback. So pipelining is supported # in non blocking mode. lappend ::valkey::callback($id) $callback - fileevent $fd readable [list ::valkey::redis_readable $fd $id] + fileevent $fd readable [list ::valkey::valkey_readable $fd $id] } } } else { @@ -196,15 +196,15 @@ proc ::valkey::__method__reconnect {id fd val} { } proc ::valkey::__method__read {id fd} { - ::valkey::redis_read_reply $id $fd + ::valkey::valkey_read_reply $id $fd } proc ::valkey::__method__rawread {id fd {len -1}} { - return [redis_safe_read $fd $len] + return [valkey_safe_read $fd $len] } proc ::valkey::__method__write {id fd buf} { - ::valkey::redis_write $fd $buf + ::valkey::valkey_write $fd $buf } proc ::valkey::__method__flush {id fd} { @@ -226,7 +226,7 @@ proc ::valkey::__method__close {id fd} { catch {unset ::valkey::callback($id)} catch {unset ::valkey::curr_argv($id)} catch {unset ::valkey::testing_resp3($id)} - catch {interp alias {} ::valkey::redisHandle$id {}} + catch {interp alias {} ::valkey::valkeyHandle$id {}} } proc ::valkey::__method__channel {id fd} { @@ -249,37 +249,37 @@ proc ::valkey::__method__attributes {id fd} { set _ $::valkey::attributes($id) } -proc ::valkey::redis_write {fd buf} { +proc ::valkey::valkey_write {fd buf} { puts -nonewline $fd $buf } -proc ::valkey::redis_writenl {fd buf} { - redis_write $fd $buf - redis_write $fd "\r\n" +proc ::valkey::valkey_writenl {fd buf} { + valkey_write $fd $buf + valkey_write $fd "\r\n" flush $fd } -proc ::valkey::redis_readnl {fd len} { - set buf [redis_safe_read $fd $len] - redis_safe_read $fd 2 ; # discard CR LF +proc ::valkey::valkey_readnl {fd len} { + set buf [valkey_safe_read $fd $len] + valkey_safe_read $fd 2 ; # discard CR LF return $buf } proc ::valkey::valkey_bulk_read {fd} { - set count [redis_read_line $fd] + set count [valkey_read_line $fd] if {$count == -1} return {} - set buf [redis_readnl $fd $count] + set buf [valkey_readnl $fd $count] return $buf } proc ::valkey::redis_multi_bulk_read {id fd} { - set count [redis_read_line $fd] + set count [valkey_read_line $fd] if {$count == -1} return {} set l {} set err {} for {set i 0} {$i < $count} {incr i} { if {[catch { - lappend l [redis_read_reply_logic $id $fd] + lappend l [valkey_read_reply_logic $id $fd] } e] && $err eq {}} { set err $e } @@ -288,15 +288,15 @@ proc ::valkey::redis_multi_bulk_read {id fd} { return $l } -proc ::valkey::redis_read_map {id fd} { - set count [redis_read_line $fd] +proc ::valkey::valkey_read_map {id fd} { + set count [valkey_read_line $fd] if {$count == -1} return {} set d {} set err {} for {set i 0} {$i < $count} {incr i} { if {[catch { - set k [redis_read_reply_logic $id $fd] ; # key - set v [redis_read_reply_logic $id $fd] ; # value + set k [valkey_read_reply_logic $id $fd] ; # key + set v [valkey_read_reply_logic $id $fd] ; # value dict set d $k $v } e] && $err eq {}} { set err $e @@ -306,24 +306,24 @@ proc ::valkey::redis_read_map {id fd} { return $d } -proc ::valkey::redis_read_line fd { - string trim [redis_safe_gets $fd] +proc ::valkey::valkey_read_line fd { + string trim [valkey_safe_gets $fd] } -proc ::valkey::redis_read_null fd { - redis_safe_gets $fd +proc ::valkey::valkey_read_null fd { + valkey_safe_gets $fd return {} } -proc ::valkey::redis_read_bool fd { - set v [redis_read_line $fd] +proc ::valkey::valkey_read_bool fd { + set v [valkey_read_line $fd] if {$v == "t"} {return 1} if {$v == "f"} {return 0} return -code error "Bad protocol, '$v' as bool type" } -proc ::valkey::redis_read_double {id fd} { - set v [redis_read_line $fd] +proc ::valkey::valkey_read_double {id fd} { + set v [valkey_read_line $fd] # unlike many other DTs, there is a textual difference between double and a string with the same value, # so we need to transform to double if we are testing RESP3 (i.e. some tests check that a # double reply is "1.0" and not "1") @@ -334,35 +334,35 @@ proc ::valkey::redis_read_double {id fd} { } } -proc ::valkey::redis_read_verbatim_str fd { +proc ::valkey::valkey_read_verbatim_str fd { set v [valkey_bulk_read $fd] # strip the first 4 chars ("txt:") return [string range $v 4 end] } -proc ::valkey::redis_read_reply_logic {id fd} { +proc ::valkey::valkey_read_reply_logic {id fd} { if {$::valkey::readraw($id)} { - return [redis_read_line $fd] + return [valkey_read_line $fd] } while {1} { - set type [redis_safe_read $fd 1] + set type [valkey_safe_read $fd 1] switch -exact -- $type { - _ {return [redis_read_null $fd]} + _ {return [valkey_read_null $fd]} : - ( - - + {return [redis_read_line $fd]} - , {return [redis_read_double $id $fd]} - # {return [redis_read_bool $fd]} - = {return [redis_read_verbatim_str $fd]} - - {return -code error [redis_read_line $fd]} + + {return [valkey_read_line $fd]} + , {return [valkey_read_double $id $fd]} + # {return [valkey_read_bool $fd]} + = {return [valkey_read_verbatim_str $fd]} + - {return -code error [valkey_read_line $fd]} $ {return [valkey_bulk_read $fd]} > - ~ - * {return [redis_multi_bulk_read $id $fd]} - % {return [redis_read_map $id $fd]} + % {return [valkey_read_map $id $fd]} | { - set attrib [redis_read_map $id $fd] + set attrib [valkey_read_map $id $fd] set ::valkey::attributes($id) $attrib continue } @@ -378,27 +378,27 @@ proc ::valkey::redis_read_reply_logic {id fd} { } } -proc ::valkey::redis_read_reply {id fd} { - set response [redis_read_reply_logic $id $fd] +proc ::valkey::valkey_read_reply {id fd} { + set response [valkey_read_reply_logic $id $fd] ::response_transformers::transform_response_if_needed $id $::valkey::curr_argv($id) $response } -proc ::valkey::redis_reset_state id { +proc ::valkey::valkey_reset_state id { set ::valkey::state($id) [dict create buf {} mbulk -1 bulk -1 reply {}] set ::valkey::statestack($id) {} } -proc ::valkey::redis_call_callback {id type reply} { +proc ::valkey::valkey_call_callback {id type reply} { set cb [lindex $::valkey::callback($id) 0] set ::valkey::callback($id) [lrange $::valkey::callback($id) 1 end] - uplevel #0 $cb [list ::valkey::redisHandle$id $type $reply] - ::valkey::redis_reset_state $id + uplevel #0 $cb [list ::valkey::valkeyHandle$id $type $reply] + ::valkey::valkey_reset_state $id } # Read a reply in non-blocking mode. -proc ::valkey::redis_readable {fd id} { +proc ::valkey::valkey_readable {fd id} { if {[eof $fd]} { - redis_call_callback $id eof {} + valkey_call_callback $id eof {} ::valkey::__method__close $id $fd return } @@ -407,9 +407,9 @@ proc ::valkey::redis_readable {fd id} { if {$line eq {}} return ;# No complete line available, return switch -exact -- [string index $line 0] { : - - + {redis_call_callback $id reply [string range $line 1 end-1]} - - {redis_call_callback $id err [string range $line 1 end-1]} - ( {redis_call_callback $id reply [string range $line 1 end-1]} + + {valkey_call_callback $id reply [string range $line 1 end-1]} + - {valkey_call_callback $id err [string range $line 1 end-1]} + ( {valkey_call_callback $id reply [string range $line 1 end-1]} $ { dict set ::valkey::state($id) bulk \ [expr [string range $line 1 end-1]+2] @@ -417,18 +417,18 @@ proc ::valkey::redis_readable {fd id} { # We got a $-1, hack the state to play well with this. dict set ::valkey::state($id) bulk 2 dict set ::valkey::state($id) buf "\r\n" - ::valkey::redis_readable $fd $id + ::valkey::valkey_readable $fd $id } } * { dict set ::valkey::state($id) mbulk [string range $line 1 end-1] # Handle *-1 if {[dict get $::valkey::state($id) mbulk] == -1} { - redis_call_callback $id reply {} + valkey_call_callback $id reply {} } } default { - redis_call_callback $id err \ + valkey_call_callback $id err \ "Bad protocol, $type as reply type byte" } } @@ -443,7 +443,7 @@ proc ::valkey::redis_readable {fd id} { if {[string length [dict get $::valkey::state($id) buf]] == [dict get $::valkey::state($id) bulk]} { if {[dict get $::valkey::state($id) mbulk] == -1} { - redis_call_callback $id reply \ + valkey_call_callback $id reply \ [string range [dict get $::valkey::state($id) buf] 0 end-2] } else { dict with ::valkey::state($id) { @@ -452,7 +452,7 @@ proc ::valkey::redis_readable {fd id} { set bulk -1 } if {[dict get $::valkey::state($id) mbulk] == 0} { - redis_call_callback $id reply \ + valkey_call_callback $id reply \ [dict get $::valkey::state($id) reply] } } diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index 3f75378e80..4df9110552 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -5,7 +5,7 @@ package require Tcl 8.5 set tcl_precision 17 -source tests/support/redis.tcl +source tests/support/valkey.tcl source tests/support/aofmanifest.tcl source tests/support/server.tcl source tests/support/cluster_util.tcl @@ -424,7 +424,7 @@ proc kill_clients {} { proc force_kill_all_servers {} { foreach p $::active_servers { - puts "Killing still running Redis server $p" + puts "Killing still running Valkey server $p" catch {exec kill -9 $p} } } @@ -560,7 +560,7 @@ proc print_help_screen {} { "--wait-server Wait after server is started (so that you can attach a debugger)." "--dump-logs Dump server log on test failure." "--tls Run tests in TLS mode." - "--tls-module Run tests in TLS mode with Redis module." + "--tls-module Run tests in TLS mode with Valkey module." "--host Run tests against an external host." "--port TCP port to use against external host." "--baseport Initial port number for spawned valkey servers." diff --git a/tests/unit/cluster/cluster-response-tls.tcl b/tests/unit/cluster/cluster-response-tls.tcl index a099fa7f05..9b4e165e99 100644 --- a/tests/unit/cluster/cluster-response-tls.tcl +++ b/tests/unit/cluster/cluster-response-tls.tcl @@ -27,7 +27,7 @@ proc cluster_response_tls {tls_cluster} { test "CLUSTER SLOTS with different connection type -- tls-cluster $tls_cluster" { set slots1 [R 0 cluster slots] set pport [srv 0 pport] - set cluster_client [redis_cluster 127.0.0.1:$pport 0] + set cluster_client [valkey_cluster 127.0.0.1:$pport 0] set slots2 [$cluster_client cluster slots] $cluster_client close # Compare the ports in the first row @@ -38,15 +38,15 @@ proc cluster_response_tls {tls_cluster} { set nodes [R 0 cluster nodes] set port1 [get_port_from_node_info [lindex [split $nodes "\r\n"] 0]] set pport [srv 0 pport] - set cluster_client [redis_cluster 127.0.0.1:$pport 0] + set cluster_client [valkey_cluster 127.0.0.1:$pport 0] set nodes [$cluster_client cluster nodes] set port2 [get_port_from_node_info [lindex [split $nodes "\r\n"] 0]] $cluster_client close assert_not_equal $port1 $port2 } - set cluster [redis_cluster 127.0.0.1:[srv 0 port]] - set cluster_pport [redis_cluster 127.0.0.1:[srv 0 pport] 0] + set cluster [valkey_cluster 127.0.0.1:[srv 0 port]] + set cluster_pport [valkey_cluster 127.0.0.1:[srv 0 pport] 0] $cluster refresh_nodes_map test "Set many keys in the cluster -- tls-cluster $tls_cluster" { diff --git a/tests/unit/expire.tcl b/tests/unit/expire.tcl index e34686a4eb..ff97a475e5 100644 --- a/tests/unit/expire.tcl +++ b/tests/unit/expire.tcl @@ -455,7 +455,7 @@ start_server {tags {"expire"}} { # to replication lag. # 2) We want to unify the way TTLs are replicated in both RDB and replication # stream, which is as absolute timestamps. - # See: https://github.com/redis/redis/issues/8433 + # See Redis OSS issue: https://github.com/redis/redis/issues/8433 r flushall ; # Clean up keyspace to avoid interference by keys from other tests set repl [attach_to_replication_stream] diff --git a/tests/unit/geo.tcl b/tests/unit/geo.tcl index 19af863993..1e87e1eb47 100644 --- a/tests/unit/geo.tcl +++ b/tests/unit/geo.tcl @@ -656,7 +656,7 @@ start_server {tags {"geo"}} { if {$res != $res2} { set diff [compare_lists $res $res2] puts "*** Possible problem in GEO radius query ***" - puts "Redis: $res" + puts "Valkey: $res" puts "Tcl : $res2" puts "Diff : $diff" puts [join $debuginfo "\n"] @@ -664,7 +664,7 @@ start_server {tags {"geo"}} { if {[lsearch -exact $res2 $place] != -1} { set where "(only in Tcl)" } else { - set where "(only in Redis)" + set where "(only in Valkey)" } lassign [lindex [r geopos mypoints $place] 0] lon lat set mydist [geo_distance $lon $lat $search_lon $search_lat] diff --git a/tests/unit/introspection-2.tcl b/tests/unit/introspection-2.tcl index 89cb4b122c..b8f4e0aed4 100644 --- a/tests/unit/introspection-2.tcl +++ b/tests/unit/introspection-2.tcl @@ -118,7 +118,7 @@ start_server {tags {"introspection"}} { assert_match {*calls=1,*} [cmdstat geoadd] } {} {needs:config-resetstat} - test {COMMAND COUNT get total number of Redis commands} { + test {COMMAND COUNT get total number of commands} { assert_morethan [r command count] 0 } diff --git a/tests/unit/introspection.tcl b/tests/unit/introspection.tcl index 78ae945dd4..582a019d2d 100644 --- a/tests/unit/introspection.tcl +++ b/tests/unit/introspection.tcl @@ -1,8 +1,8 @@ start_server {tags {"introspection"}} { test "PING" { assert_equal {PONG} [r ping] - assert_equal {redis} [r ping redis] - assert_error {*wrong number of arguments for 'ping' command} {r ping hello redis} + assert_equal {valkey} [r ping valkey] + assert_error {*wrong number of arguments for 'ping' command} {r ping hello valkey} } test {CLIENT LIST} { @@ -739,7 +739,7 @@ start_server {tags {"introspection"}} { catch {exec src/valkey-server --shutdown-on-sigint "now force" --shutdown-on-sigterm} err assert_match {*'shutdown-on-sigterm'*argument(s) must be one of the following*} $err - # Something like `redis-server --some-config --config-value1 --config-value2 --loglevel debug` would break, + # Something like `valkey-server --some-config --config-value1 --config-value2 --loglevel debug` would break, # because if you want to pass a value to a config starting with `--`, it can only be a single value. catch {exec src/valkey-server --replicaof 127.0.0.1 abc} err assert_match {*'replicaof "127.0.0.1" "abc"'*Invalid master port*} $err diff --git a/tests/unit/maxmemory.tcl b/tests/unit/maxmemory.tcl index 19b05cc9cb..92e68ac1ed 100644 --- a/tests/unit/maxmemory.tcl +++ b/tests/unit/maxmemory.tcl @@ -225,7 +225,7 @@ start_server {tags {"maxmemory external:skip"}} { } # If we add the same number of keys already added again and # the policy is allkeys-* we should still be under the limit. - # Otherwise we should see an error reported by Redis. + # Otherwise we should see an error reported by Server. set err 0 for {set j 0} {$j < $numkeys} {incr j} { if {[catch {r set [randomKey] x} e]} { diff --git a/tests/unit/moduleapi/moduleauth.tcl b/tests/unit/moduleapi/moduleauth.tcl index d7399d0ff1..745285312b 100644 --- a/tests/unit/moduleapi/moduleauth.tcl +++ b/tests/unit/moduleapi/moduleauth.tcl @@ -286,7 +286,7 @@ start_server {tags {"modules"}} { assert_match {*calls=2,*,rejected_calls=0,failed_calls=1} [cmdstat auth] } - test {Disabling Redis User during blocking module auth} { + test {Disabling Valkey User during blocking module auth} { r config resetstat r acl setuser foo >pwd on ~* &* +@all set rd [valkey_deferring_client] diff --git a/tests/unit/other.tcl b/tests/unit/other.tcl index 72781838d5..503ee391a9 100644 --- a/tests/unit/other.tcl +++ b/tests/unit/other.tcl @@ -466,7 +466,7 @@ start_server {tags {"other external:skip"}} { start_cluster 1 0 {tags {"other external:skip cluster slow"}} { r config set dynamic-hz no hz 500 - test "Redis can trigger resizing" { + test "Server can trigger resizing" { r flushall # hashslot(foo) is 12182 for {set j 1} {$j <= 128} {incr j} { @@ -496,7 +496,7 @@ start_cluster 1 0 {tags {"other external:skip cluster slow"}} { } } {} {needs:debug} - test "Redis can rewind and trigger smaller slot resizing" { + test "Server can rewind and trigger smaller slot resizing" { # hashslot(foo) is 12182 # hashslot(alice) is 749, smaller than hashslot(foo), # attempt to trigger a resize on it, see details in #12802. @@ -526,7 +526,7 @@ start_cluster 1 0 {tags {"other external:skip cluster slow"}} { } start_server {tags {"other external:skip"}} { - test "Redis can resize empty dict" { + test "Server can resize empty dict" { # Write and then delete 128 keys, creating an empty dict r flushall for {set j 1} {$j <= 128} {incr j} { diff --git a/tests/unit/printver.tcl b/tests/unit/printver.tcl index c80f45144d..53cfed8ee6 100644 --- a/tests/unit/printver.tcl +++ b/tests/unit/printver.tcl @@ -2,5 +2,5 @@ start_server {} { set i [r info] regexp {redis_version:(.*?)\r\n} $i - version regexp {redis_git_sha1:(.*?)\r\n} $i - sha1 - puts "Testing Redis version $version ($sha1)" + puts "Testing Valkey version $version ($sha1)" } diff --git a/tests/unit/protocol.tcl b/tests/unit/protocol.tcl index cd7dbe9e5a..f3a2b8e1a8 100644 --- a/tests/unit/protocol.tcl +++ b/tests/unit/protocol.tcl @@ -94,7 +94,7 @@ start_server {tags {"protocol network"}} { set elapsed [expr {[clock seconds]-$test_start}] if {$elapsed > $test_time_limit} { close $s - error "assertion:Redis did not closed connection after protocol desync" + error "assertion:Valkey did not closed connection after protocol desync" } } } diff --git a/tests/unit/pubsub.tcl b/tests/unit/pubsub.tcl index 5a2439814f..2f336dfcb9 100644 --- a/tests/unit/pubsub.tcl +++ b/tests/unit/pubsub.tcl @@ -483,7 +483,7 @@ start_server {tags {"pubsub network"}} { r hello 3 # Note: SUBSCRIBE and UNSUBSCRIBE with multiple channels in the same command, - # breaks the multi response, see https://github.com/redis/redis/issues/12207 + # breaks the multi response, see Redis OSS issue: https://github.com/redis/redis/issues/12207 # this is just a temporary sanity test to detect unintended breakage. # subscribe for 3 channels actually emits 3 "responses" diff --git a/tests/unit/scripting.tcl b/tests/unit/scripting.tcl index 126f4eba4a..ea5c1b899f 100644 --- a/tests/unit/scripting.tcl +++ b/tests/unit/scripting.tcl @@ -1055,7 +1055,7 @@ start_server {tags {"scripting"}} { test "Try trick global protection 3" { catch { run_script { - valkey = function() return 1 end + redis = function() return 1 end } 0 } e set _ $e diff --git a/utils/speed-regression.tcl b/utils/speed-regression.tcl index 6802d8cd5e..2a4ecde452 100755 --- a/utils/speed-regression.tcl +++ b/utils/speed-regression.tcl @@ -2,7 +2,7 @@ # Copyright (C) 2011 Salvatore Sanfilippo # Released under the BSD license like Redis itself -source ../tests/support/redis.tcl +source ../tests/support/valkey.tcl set ::port 12123 set ::tests {PING,SET,GET,INCR,LPUSH,LPOP,SADD,SPOP,LRANGE_100,LRANGE_600,MSET} set ::datasize 16 @@ -20,25 +20,25 @@ proc run-tests branches { exec -ignorestderr make 2> /dev/null if {$branch_id == 0} { - puts " copy redis-benchmark from unstable to /tmp..." - exec -ignorestderr cp ./redis-benchmark /tmp + puts " copy valkey-benchmark from unstable to /tmp..." + exec -ignorestderr cp ./valkey-benchmark /tmp incr branch_id continue } # Start the server - puts " starting the server... [exec ./redis-server -v]" - set pids [exec echo "port $::port\nloglevel warning\n" | ./redis-server - > /dev/null 2> /dev/null &] + puts " starting the server... [exec ./valkey-server -v]" + set pids [exec echo "port $::port\nloglevel warning\n" | ./valkey-server - > /dev/null 2> /dev/null &] puts " pids: $pids" after 1000 puts " running the benchmark" set r [redis 127.0.0.1 $::port] set i [$r info] - puts " redis INFO shows version: [lindex [split $i] 0]" + puts " valkey INFO shows version: [lindex [split $i] 0]" $r close - set output [exec /tmp/redis-benchmark -n $::requests -t $::tests -d $::datasize --csv -p $::port] + set output [exec /tmp/valkey-benchmark -n $::requests -t $::tests -d $::datasize --csv -p $::port] lappend runs $b $output puts " killing server..." catch {exec kill -9 [lindex $pids 0]}