Skip to content

Commit

Permalink
Merge branch 'valkey-io:unstable' into announce-module
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivshankar-Reddy authored Apr 25, 2024
2 parents dbcf751 + 52f9291 commit d76a53b
Show file tree
Hide file tree
Showing 34 changed files with 74 additions and 59 deletions.
15 changes: 15 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion src/dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -1809,7 +1809,7 @@ dictType BenchmarkDictType = {
printf(msg ": %ld items in %lld ms\n", count, elapsed); \
} while(0)

/* ./redis-server test dict [<count> | --accurate] */
/* ./valkey-server test dict [<count> | --accurate] */
int dictTest(int argc, char **argv, int flags) {
long j;
long long start, elapsed;
Expand Down
2 changes: 1 addition & 1 deletion src/kvstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/syscheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ziplist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <randomseed> */
/* ./valkey-server test ziplist <randomseed> */
int ziplistTest(int argc, char **argv, int flags) {
int accurate = (flags & TEST_ACCURATE);
unsigned char *zl, *p;
Expand Down
2 changes: 1 addition & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/bg_block_op.tcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source tests/support/redis.tcl
source tests/support/valkey.tcl
source tests/support/util.tcl

set ::tlsdir "tests/tls"
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/bg_complex_data.tcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source tests/support/redis.tcl
source tests/support/valkey.tcl
source tests/support/util.tcl

set ::tlsdir "tests/tls"
Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/gen_write_load.tcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source tests/support/redis.tcl
source tests/support/valkey.tcl

set ::tlsdir "tests/tls"

Expand Down
22 changes: 11 additions & 11 deletions tests/instances.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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 <host> Use hostname instead of 127.0.0.1."
puts "--config <k> <v> Extra config argument(s)."
puts "--stop Blocks once the first test fails."
Expand Down Expand Up @@ -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}} {
Expand All @@ -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]: "
Expand Down Expand Up @@ -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 <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 Valkey <id>."
puts "SI <id> <field> Show Sentinel <id> INFO <field>."
puts "RI <id> <field> Show Redis <id> INFO <field>."
puts "RI <id> <field> Show Valkey <id> INFO <field>."
puts "continue Resume test."
} else {
set errcode [catch {eval $line} retval]
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/valkey-cli.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion tests/sentinel/tests/00-base.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/sentinel/tests/02-slaves-reconf.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/sentinel/tests/05-manual.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/sentinel/tests/12-master-reboot.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/support/cluster.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ proc ::valkey_cluster::__dispatch__ {id method args} {
# Get the keys from the command.
set keys [::valkey_cluster::get_keys_from_command $method $args]
if {$keys eq {}} {
error "Redis command '$method' is not supported by valkey_cluster."
error "Valkey command '$method' is not supported by valkey_cluster."
}

# Resolve the keys in the corresponding hash slot they hash to.
Expand Down Expand Up @@ -250,7 +250,7 @@ proc ::valkey_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 ::valkey_cluster::__method__$method $id] $args
}
Expand Down
2 changes: 1 addition & 1 deletion tests/support/server.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/support/test.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
2 changes: 1 addition & 1 deletion tests/support/redis.tcl → tests/support/valkey.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# }
# }
#
# set r [redis]
# set r [valkey]
# $r blocking 0
# $r get fo [list handlePong]
#
Expand Down
6 changes: 3 additions & 3 deletions tests/test_helper.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
}
}
Expand Down Expand Up @@ -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 <addr> Run tests against an external host."
"--port <port> TCP port to use against external host."
"--baseport <port> Initial port number for spawned valkey servers."
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/expire.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/geo.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -656,15 +656,15 @@ 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"]
foreach place $diff {
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]
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/introspection-2.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/introspection.tcl
Original file line number Diff line number Diff line change
@@ -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} {
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/maxmemory.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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]} {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/moduleapi/moduleauth.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading

0 comments on commit d76a53b

Please sign in to comment.