Skip to content

v4: HOTKEYS and CLIENT KILL render through IRespArgument operands; dead List<RedisValue> builders deleted - #3321

Merged
mgravell merged 1 commit into
v4from
marc/interpolated-cleanup
Oct 31, 2026
Merged

mgravell merged 1 commit into
v4from
marc/interpolated-cleanup

Conversation

@mgravell

Copy link
Copy Markdown
Member

An audit of v4 for command paths still rendering arguments the legacy way — building a RedisValue list/array and splicing it in — rather than writing through the interpolated handler. This PR converts the two clear cases and deletes what the old-core removal orphaned.

Converted

  • HOTKEYS START: HotKeysStartArgs (List<RedisValue> → ToArray() → spliced hole) becomes HotKeysStartOperand : IRespArgument, writing each conditional clause straight into the frame; the tokens are now pre-framed RespLiterals fragments (START/METRICS/CPU/NET/DURATION/SAMPLE/STOP), and the STOP/RESET/GET subcommands move off RedisLiterals values too. HotKeysWireTests pins the wire shape byte-for-byte, including the duration round-up.
  • CLIENT KILL: ClientKillFilter.ToList/ToArray become ClientKillFilter.Operand — still the one encoding shared by both public spellings — and ClientKillCount takes the operand instead of a pre-rendered span. The test that compared against ToList now asserts the rendered frame, and gains a replica/slave spelling theory for both server generations.

Deleted (dead since the old core went; no callers)

  • GeoSearchShape.AddArgs(List<RedisValue>) (abstract + both overrides) — the live path is the ref RespRequestBuilder twin.
  • GeoRadiusOptionsExtensions.AddArgs — same story.
  • StreamIdempotentId.WriteTo(RedisValue[], ref int) — the live XADD path writes via the stream AddOperand.

Deliberately omitted

Left as-is, each with an in-code comment defending the current form; flagging them so the omission is a decision rather than an oversight:

  • RedisServer.LatencyEventNames — one string[] → RedisValue[] conversion feeding a span hole, documented as a single allocation on a cold admin path.
  • RespHandshake CLIENT TRACKING prefixes — builds RedisValue[3 + 2n] for the PREFIX pairs because "the number of PREFIX pairs is not known until here"; an operand struct would solve exactly that, but it is handshake-only.
  • RenderedArgs.cs + IRenderedArgsOwner — orphaned old-core machinery (zero references in src; only its own tests exercise it), but it lives on main, so deleting it in v4 buys recurring merge churn.
  • DebuggingAids.cs/LoggingPipe.cs #if LOGOUTPUT blocks — extend PhysicalConnection, which no longer exists, so the define would no longer compile; same merge-churn consideration.

Happy to fold any of the omitted items into this PR if the trade-offs read differently to you.

… dead List<RedisValue> builders go

The v4 model is the interpolated writer: conditional clauses belong in an
operand struct that writes straight into the frame, not in a RedisValue
list spliced in as an array. HOTKEYS START and CLIENT KILL were the last
two command paths still rendering the old way.

- HotKeysStartArgs becomes HotKeysStartOperand, with the tokens as
  pre-framed RespLiterals; the STOP/RESET/GET subcommands move to
  fragments too. HotKeysWireTests pins the clause order byte for byte.
- ClientKillFilter.ToList/ToArray become ClientKillFilter.Operand - still
  the one encoding both public spellings of CLIENT KILL share - and
  ClientKillCount takes the operand instead of a rendered span. The test
  that compared against ToList now asserts the rendered frame, which also
  covers the replica/slave spelling both ways.
- Dead since the old core was deleted, called by nothing: the List-based
  GeoSearchShape.AddArgs overloads, the GeoRadiusOptions.AddArgs
  extension, and StreamIdempotentId.WriteTo(RedisValue[], ref int).
@mgravell
mgravell merged commit 41b4962 into v4 Oct 31, 2026
4 checks passed
@mgravell
mgravell deleted the marc/interpolated-cleanup branch October 31, 2026 12:56
mgravell added a commit that referenced this pull request Nov 2, 2026
…s, and RenderedArgs goes (#3327)

The stragglers #3321 deliberately left: LatencyEventNames (the string[] ->
RedisValue[] copy) becomes an internal string[] overload on the Diagnostics
group writing through EventNamesOperand; the handshake's CLIENT TRACKING
broadcast splice becomes TrackingPrefixesOperand (nothing when prefix-less,
collapsing the two broadcast branches), with the tokens moving to pre-framed
RespLiterals fragments and the dead RedisValue literals - OFF included -
retired; and RenderedArgs + IRenderedArgsOwner (no implementers since the old
core went) are deleted along with their tests. Wire tests pin both operands
byte-for-byte.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant