mirror of
https://github.com/hanzoai/kv.git
synced 2026-11-09 16:05:35 +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.
104 lines
3.5 KiB
Tcl
104 lines
3.5 KiB
Tcl
# One XADD with one huge 5GB field
|
|
# Expected to fail resulting in an empty stream
|
|
run_solo {violations} {
|
|
start_server [list overrides [list save ""] tags {"large-memory"}] {
|
|
test {XADD one huge field} {
|
|
r config set proto-max-bulk-len 10000000000 ;#10gb
|
|
r config set client-query-buffer-limit 10000000000 ;#10gb
|
|
r write "*5\r\n\$4\r\nXADD\r\n\$2\r\nS1\r\n\$1\r\n*\r\n"
|
|
r write "\$1\r\nA\r\n"
|
|
catch {
|
|
write_big_bulk 5000000000 ;#5gb
|
|
} err
|
|
assert_match {*too large*} $err
|
|
r xlen S1
|
|
} {0}
|
|
}
|
|
|
|
# One XADD with one huge (exactly nearly) 4GB field
|
|
# This uncovers the overflow in lpEncodeGetType
|
|
# Expected to fail resulting in an empty stream
|
|
start_server [list overrides [list save ""] tags {"large-memory"}] {
|
|
test {XADD one huge field - 1} {
|
|
r config set proto-max-bulk-len 10000000000 ;#10gb
|
|
r config set client-query-buffer-limit 10000000000 ;#10gb
|
|
r write "*5\r\n\$4\r\nXADD\r\n\$2\r\nS1\r\n\$1\r\n*\r\n"
|
|
r write "\$1\r\nA\r\n"
|
|
catch {
|
|
write_big_bulk 4294967295 ;#4gb-1
|
|
} err
|
|
assert_match {*too large*} $err
|
|
r xlen S1
|
|
} {0}
|
|
}
|
|
|
|
# Gradually add big stream fields using repeated XADD calls
|
|
start_server [list overrides [list save ""] tags {"large-memory"}] {
|
|
test {several XADD big fields} {
|
|
r config set stream-node-max-bytes 0
|
|
for {set j 0} {$j<10} {incr j} {
|
|
r xadd stream * 1 $::str500 2 $::str500
|
|
}
|
|
r ping
|
|
r xlen stream
|
|
} {10}
|
|
}
|
|
|
|
# Add over 4GB to a single stream listpack (one XADD command)
|
|
# Expected to fail resulting in an empty stream
|
|
start_server [list overrides [list save ""] tags {"large-memory"}] {
|
|
test {single XADD big fields} {
|
|
r write "*23\r\n\$4\r\nXADD\r\n\$1\r\nS\r\n\$1\r\n*\r\n"
|
|
for {set j 0} {$j<10} {incr j} {
|
|
r write "\$1\r\n$j\r\n"
|
|
write_big_bulk 500000000 "" yes ;#500mb
|
|
}
|
|
r flush
|
|
catch {r read} err
|
|
assert_match {*too large*} $err
|
|
r xlen S
|
|
} {0}
|
|
}
|
|
|
|
# Gradually add big hash fields using repeated HSET calls
|
|
# This reproduces the overflow in the call to ziplistResize
|
|
# Object will be converted to hashtable encoding
|
|
start_server [list overrides [list save ""] tags {"large-memory"}] {
|
|
r config set hash-max-ziplist-value 1000000000 ;#1gb
|
|
test {hash with many big fields} {
|
|
for {set j 0} {$j<10} {incr j} {
|
|
r hset h $j $::str500
|
|
}
|
|
r object encoding h
|
|
} {hashtable}
|
|
}
|
|
|
|
# Add over 4GB to a single hash field (one HSET command)
|
|
# Object will be converted to hashtable encoding
|
|
start_server [list overrides [list save ""] tags {"large-memory"}] {
|
|
test {hash with one huge field} {
|
|
catch {r config set hash-max-ziplist-value 10000000000} ;#10gb
|
|
r config set proto-max-bulk-len 10000000000 ;#10gb
|
|
r config set client-query-buffer-limit 10000000000 ;#10gb
|
|
r write "*4\r\n\$4\r\nHSET\r\n\$2\r\nH1\r\n"
|
|
r write "\$1\r\nA\r\n"
|
|
write_big_bulk 5000000000 ;#5gb
|
|
r object encoding H1
|
|
} {hashtable}
|
|
}
|
|
} ;# run_solo
|
|
|
|
# SORT which stores an integer encoded element into a list.
|
|
# Just for coverage, no news here.
|
|
start_server [list overrides [list save ""] ] {
|
|
test {SORT adds integer field to list} {
|
|
r set S1 asdf
|
|
r set S2 123 ;# integer encoded
|
|
assert_encoding "int" S2
|
|
r sadd myset 1 2
|
|
r mset D1 1 D2 2
|
|
r sort myset by D* get S* store mylist
|
|
r llen mylist
|
|
} {2} {cluster:skip}
|
|
}
|