Files
zeekay 5b2e5fe98e fix: revert the -X ours upstream merge, which left the tree uncompilable
`merge: upstream/unstable (-X ours, brand preserved)` resolved every conflicting
hunk in our favour. That is right for brand strings and wrong for code: it kept
our old server.h beside their new module.c, so module.c calls
commandResultSuccessListeners and reads from_call_argv off a struct that has
neither, and zslFreeLexRange lost the declarations it still has call sites for.
kvReaderFeed got a newer body calling kvReaderGetReadBuf/CommitRead grafted onto
older locals — an sds newbuf and an oom: label the new body never uses. Across
398 files nothing downstream noticed, because main has not compiled since.

That is what the Dockerfile was working around. Pulling valkey/valkey and copying
binaries out of it produced an image no matter what the source did, so a tree
that cannot build looked like a tree that builds. Now the image compiles this
source, so the build breaking is visible the moment it breaks.

src, deps and tests return to the last coherent commit. Carried forward on top:

  - Two identical rdbIsVersionAccepted definitions, differing only in a
    parameter name. The rename pass copied the function instead of editing it,
    so this never compiled either.
  - kv_strtod.h lost the #ifdef USE_FAST_FLOAT that separated its two
    implementations, leaving both definitions and a stray #endif.
  - extended-redis-compatibility is deleted, not defaulted off. It made the
    server answer HELLO with "redis" and name itself Redis in five error
    strings. A server that can be configured to lie about what it is has one
    setting too many. HELLO now reports kv unconditionally.
  - The redis-server and redis-cli install symlinks, on by default via
    USE_REDIS_SYMLINKS?=yes. This is why a running instance answered to
    redis-cli at all.
  - valkeymodule.h and redismodule.h, 3094 lines of adapters mapping old
    prefixes onto KVMODULE_*, included by nothing. kvmodule.h is the header.
  - deps/libvalkey, one documentation file the rename stranded.

Wire contract is untouched. INFO still reports redis_version, redis_git_sha1,
redis_git_dirty and redis_build_id, and the Lua sandbox still exports
REDIS_VERSION — clients parse those field names, so they are protocol, not
branding. What we choose is what the server calls itself, and it calls itself kv.

Verified: builds clean, and a live instance answers HELLO with "server kv",
reports server_name:kv, has no extended-redis-compatibility directive, and
serves strings and lists.
2026-07-26 15:04:44 -07:00

88 lines
3.6 KiB
Tcl

start_cluster 2 2 {tags {external:skip cluster}} {
test {Key lazy expires during key migration} {
R 0 DEBUG SET-ACTIVE-EXPIRE 0
set key_slot [R 0 CLUSTER KEYSLOT FOO]
R 0 set FOO BAR PX 10
set src_id [R 0 CLUSTER MYID]
set trg_id [R 1 CLUSTER MYID]
R 0 CLUSTER SETSLOT $key_slot MIGRATING $trg_id
R 1 CLUSTER SETSLOT $key_slot IMPORTING $src_id
after 11
assert_error {ASK*} {R 0 GET FOO}
R 0 ping
} {PONG}
test "Coverage: Basic cluster commands" {
assert_equal {OK} [R 0 CLUSTER saveconfig]
set id [R 0 CLUSTER MYID]
assert_equal {0} [R 0 CLUSTER count-failure-reports $id]
R 0 flushall
assert_equal {OK} [R 0 CLUSTER flushslots]
}
}
start_cluster 1 1 {tags {external:skip cluster}} {
test {Cross-slot transaction} {
assert_equal OK [R 0 multi]
assert_equal QUEUED [r get foo]
assert_equal QUEUED [r get bar]
assert_error {CROSSSLOT *} {r exec}
}
}
# Create a folder called "nodes.conf" to trigger temp nodes.conf rename
# failure and it will cause cluster config file save to fail at the rename.
proc create_nodes_conf_folder {srv_idx} {
set dir [lindex [R $srv_idx config get dir] 1]
set cluster_conf [lindex [R $srv_idx config get cluster-config-file] 1]
set cluster_conf_path [file join $dir $cluster_conf]
if {[file exists $cluster_conf_path]} { exec rm -f $cluster_conf_path }
exec mkdir -p $cluster_conf_path
}
start_cluster 1 1 {tags {external:skip cluster}} {
test {Fail to save the cluster configuration file will not exit the process} {
# Create folder that can cause the rename fail.
create_nodes_conf_folder 0
create_nodes_conf_folder 1
# Trigger a takeover so that cluster will need to update the config file.
R 1 cluster failover takeover
wait_for_condition 1000 50 {
[s 0 role] eq {slave} &&
[s -1 role] eq {master}
} else {
fail "The failover does not happen"
}
# Make sure the process is still alive, we won't exit when fail to save the config file.
assert_equal {PONG} [R 0 ping]
assert_equal {PONG} [R 1 ping]
assert_equal 1 [process_is_alive [srv 0 pid]]
assert_equal 1 [process_is_alive [srv -1 pid]]
# Make sure relevant logs are printed.
verify_log_message 0 "*Could not rename tmp cluster config file*" 0
verify_log_message -1 "*Could not rename tmp cluster config file*" 0
verify_log_message 0 "*Cluster config updated even though writing the cluster config file to disk failed*" 0
verify_log_message -1 "*Cluster config updated even though writing the cluster config file to disk failed*" 0
# Trigger a takeover so that cluster will need to update the config file.
# We will not frequently print the "save failed" log.
R 0 cluster failover takeover
wait_for_condition 1000 50 {
[s 0 role] eq {master} &&
[s -1 role] eq {slave}
} else {
fail "The failover does not happen"
}
assert_morethan_equal [count_log_message 0 "Could not rename tmp cluster config file"] 2
assert_equal [count_log_message 0 "Cluster config updated even though writing the cluster config file to disk failed"] 1
assert_morethan_equal [count_log_message -1 "Could not rename tmp cluster config file"] 2
assert_equal [count_log_message -1 "Cluster config updated even though writing the cluster config file to disk failed"] 1
}
}