mirror of
https://github.com/hanzoai/kv.git
synced 2026-11-21 08:42:06 +00:00
`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.
76 lines
1.8 KiB
Bash
Executable File
76 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Verify that a client disconnects from known nodes without following
|
|
# redirects, this to avoid reconnecting to already disconnected nodes.
|
|
# The client will not accept new commands thereafter.
|
|
#
|
|
# Usage: $0 /path/to/clusterclient-binary
|
|
|
|
clientprog=${1:-./clusterclient_async}
|
|
testname=client-disconnect-test
|
|
|
|
# Sync processes waiting for CONT signals.
|
|
perl -we 'use sigtrap "handler", sub{exit}, "CONT"; sleep 1; die "timeout"' &
|
|
syncpid1=$!;
|
|
|
|
# Start simulated kv node
|
|
timeout 5s ./simulated-kv.pl -p 7401 -d --sigcont $syncpid1 <<'EOF' &
|
|
EXPECT CONNECT
|
|
EXPECT ["CLUSTER", "SLOTS"]
|
|
SEND [[0, 16383, ["127.0.0.1", 7401, "nodeid1"]]]
|
|
EXPECT CLOSE
|
|
|
|
EXPECT CONNECT
|
|
EXPECT ["SET", "foo", "initial"]
|
|
SEND +OK
|
|
|
|
EXPECT ["SET", "foo", "redirect"]
|
|
SEND -MOVED 12182 127.0.0.1:7402
|
|
|
|
EXPECT CLOSE
|
|
EOF
|
|
server1=$!
|
|
|
|
# Wait until node is ready to accept client connections
|
|
wait $syncpid1;
|
|
|
|
# Run client
|
|
timeout 4s "$clientprog" --blocking-initial-update --connection-events 127.0.0.1:7401 > "$testname.out" <<'EOF'
|
|
SET foo initial
|
|
|
|
# Send a command that is expected to be redirected just before
|
|
# requesting a client disconnect.
|
|
!async
|
|
SET foo redirect
|
|
!disconnect
|
|
!sync
|
|
|
|
# Commands are not accepted after a disconnect.
|
|
SET foo not-accepted
|
|
EOF
|
|
clientexit=$?
|
|
|
|
# Wait for server to exit
|
|
wait $server1; server1exit=$?
|
|
|
|
# Check exit statuses
|
|
if [ $server1exit -ne 0 ]; then
|
|
echo "Simulated server #1 exited with status $server1exit"
|
|
exit $server1exit
|
|
fi
|
|
if [ $clientexit -ne 0 ]; then
|
|
echo "$clientprog exited with status $clientexit"
|
|
exit $clientexit
|
|
fi
|
|
|
|
expected="Event: connect to 127.0.0.1:7401
|
|
OK
|
|
MOVED 12182 127.0.0.1:7402
|
|
Event: disconnect from 127.0.0.1:7401
|
|
error: disconnecting"
|
|
|
|
echo "$expected" | diff -u - "$testname.out" || exit 99
|
|
|
|
# Clean up
|
|
rm "$testname.out"
|