Files
zeekayandHanzo Dev d9326e5ce1 feat(cluster): CLUSTERSCAN — recover the implementation, three commits deep
Same shape as MSETEX: the `-X ours` upstream merge took new files and
discarded edits to existing ones, so `clusterscan.json` and the whole
459-line test file landed while `clusterscanCommand` never did. The tests
have been in the tree failing since; the spec was parked because it
generated a reference to a symbol nobody had written.

Recovered the chain in order, because the first commit alone is not
correct:

  b70dbec66  CLUSTERSCAN Command (#2934)
  e64150914  MATCH pattern maps to a specific slot (#3380)
  f63e2ce07  range bounded scanning across contiguous slots (#3391)

#2934 parses SLOT itself and defers COUNT/MATCH/TYPE to
scanGenericCommand — which the cursor-"0" path returns before ever
reaching, so `CLUSTERSCAN 0 COUNT 0` answered instead of erroring. #3380
replaces that with parseScanOptionsOrReply up front. Landing only the
base would have shipped a known-red test.

Held back deliberately:

  3a7fe2ec7  fingerprint from configurable_hash_seed (#3679)

It needs getConfigurableHashSeed() from #3366, which this tree does not
carry either. clusterscanFingerprint() therefore reads the per-process
random hashtableGetHashFunctionSeed(), exactly as upstream did before
#3679. Bounded, cluster-only consequence: a cursor restarts at 0 after
failover rather than surviving it. The two tests that assert otherwise
are removed with a comment naming the dependency, so whoever lands #3366
knows to bring them back in the same change.

Also repaired four test files the rebrand missed — they called
`valkey_cluster` / `valkey_deferring_client{,_by_addr}` when the procs
are defined as `kv_*`, so unit/cluster/resharding and two moduleapi
suites died with `invalid command name` before running a single test.
And `clusterscan` was missing from cluster.tcl's routable-command list,
which is a different error with the same cause.

Tests: unit/cluster/clusterscan 19/19. Regression over scan, expire,
keyspace, hash, set, zset, incr, list — 238 ok, 0 failures (#3391
rewrites scanGenericCommand's cursor handling, so those are the suites
that matter).

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 11:10:38 -07:00

41 lines
1.2 KiB
Tcl

set testmodule [file normalize tests/modules/deferred_reply.so]
start_server {tags {"modules logreqres:skip"}} {
r module load $testmodule
test {Deferred reply with postponed array length during active deferred reply buffer} {
r deferred_reply.arm
set rd [kv_deferring_client]
# SET triggers NOTIFY_STRING. The module callback blocks the client;
# the reply callback builds a nested array using POSTPONED_LEN while
# the deferred reply buffer is active.
$rd set testkey testval
wait_for_blocked_clients_count 1
wait_for_blocked_clients_count 0
set set_reply [$rd read]
set cb_reply [$rd read]
# Drain any extra data so we can report it on failure.
$rd ping diag
set extra {}
set tok [$rd read]
while {$tok ne "diag"} {
lappend extra $tok
set tok [$rd read]
}
if {$set_reply ne "OK" || $cb_reply ne "first {a b}" || $extra ne {}} {
fail "Malformed deferred reply output: set_reply='$set_reply' cb_reply='$cb_reply' extra='$extra'"
}
$rd close
}
test "Unload the module - deferred_reply" {
assert_equal {OK} [r module unload deferred_reply]
}
}