Skip to content

v4: absorb main 3.5.0, part 10 - Redis 8.12 commands (#3343) - #3414

Merged
mgravell merged 1 commit into
v4from
marc/v4-absorb-3343
Dec 3, 2026
Merged

mgravell merged 1 commit into
v4from
marc/v4-absorb-3343

Conversation

@mgravell

@mgravell mgravell commented Dec 3, 2026

Copy link
Copy Markdown
Member

Ports main #3343 (the Redis 8.12 commands, SER011) onto the v4 core.

Taken from main unchanged:

  • The IDatabase/IDatabaseAsync/IServer surface, with main's exact signatures: StringBitPositions, the Expiration overloads of SetAdd, SetMemberExpire/GetTimeToLive/GetExpireDateTime/Persist, KeyBless/KeyUnbless/KeyBlessFlags, IServer.BlessedKeys, and SortedSetMove/MoveByScore/MoveMembers. Also BlessFlags, CommandTrace.CpuTime, the RedisFeatures and KeyNotificationType additions, and the RedisCommand/CommandMap entries.
  • The wire shapes: argument order, BYTE omitted, COUNT only when given (always for BLESS SCAN), an empty member list sent as MEMBERS 0 for the server to reject, and BLESS SET/CLEAR raised to the primary.
  • docs/exp/SER011.md, the coverage ledger, the TransactionAnalyzer note, the plans under notes/, and the live tests (BitTests, BlessTests, SetMemberExpiryTests, SortedSetMoveTests).

Rewritten for v4. Every command is a group method, and the IDatabase members delegate to them:

  • Bitmaps.PositionsAsync(key, bit, start = 0, end = -1, indexType = Byte, limit = null), returning ReadOnlyLease<long>.
  • Sets.AddWithExpiryAsync(key, value | values, Expiration expiry, When when = Always), returning bool. It's named apart from AddAsync for the reason Hashes.SetWithExpiryAsync is: SADD counts new members, SADDEX says whether the write happened.
  • Sets.ExpireAsync(key, members, Expiration expiry, ExpireWhen when = Always), plus PersistAsync, GetTimeToLiveAsync and GetExpireDateTimeAsync, each returning a lease. As in Hashes.ExpireAsync, the Expiration picks between SEXPIRE, SPEXPIRE, SEXPIREAT and SPEXPIREAT, so main's two TimeSpan/DateTime overloads are one method here. KeepTtl and Persist are refused. SPTTL is never client-cached.
  • Keys.BlessAsync/UnblessAsync(key, BlessFlags bless) and Keys.BlessFlagsAsync(key).
  • SortedSets.MoveAsync(source, destination, order = Ascending, count = null), MoveByScoreAsync(source, destination, start, stop, exclude = None, count = null) and MoveMembersAsync(source, destination, members, when = Always). Each returns ReadOnlyLease<SortedSetEntry>?, which is null when nothing moved.
  • Internal *Array siblings serve the IDatabase arrays. IServer.BlessedKeys is a RespScanEnumerable over BLESS SCAN, using the SCAN page handler. All group methods are [Experimental(SER011)].

Small differences from main:

  • The ZMOVE reply reader is strict, like main's processor: nested pairs only. It isn't v4's shared ZRANGE/ZPOP reader, which would accept a flat [member, score] run as RESP2 pairs.
  • v4 checks that every command has a retry category, so the new commands now have one: the set-member TTL reads and BITRANGEINTARRAY are read-only, SPERSIST is checked, and SADDEX and the member expire commands are last-wins (MNX/MXX and NX/XX/GT/LT are raised to checked, as for hashes). Main has no such check, so it left these out.
  • I dropped main's KeyPrefixed* changes and its tests, because v4 has no KeyspaceIsolation wrappers. I also left out the unused RedisLiterals additions; the tokens are RespLiterals here.

Tests. The round-trip and reply tests now go through v4's harness: RoundTrip.ExecuteAsync with the IDatabase call, and the group handlers directly. The cases and bytes are main's. Server812GroupRoundTrip adds coverage of the lease-returning group forms.

Testing:

  • New unit tests (round-trip, reply parsing, CommandTraceParse, KeyNotificationUnitTests): 329/329 on net10.0. Swapping NX/XX in MoveMembersCommand fails 2.
  • Live tests: the local topology here runs a pre-8.12 unstable build (255.255.255), which passes the version gate but lacks the commands. So BitTests, BlessTests, SetMemberExpiryTests, SortedSetMoveTests and ScanTests were run against a standalone client-libs-test:8.12.0 container: 148 passed, 12 skipped. The 2 failures were the cluster-only SortedSetMoveTests.Cluster_SameSlot_RoutesAndMoves, which ran on that same old build in the cluster and failed on the unknown command.
  • Full net10.0 suite: the v4 baseline of 112 failures, plus the 90 live 8.12 tests above failing on the old local server for the same unknown-command reason. Two others failed once in the full run: RespAggregateProtoTests.ADeferredWalkNeedsNoStorageAtAll and RespAggregateTimingTests.ADeferredWalkAgainstMaterialiseThenRead. They are allocation and timing tests, and both pass 3/3 in isolation.
  • SanityChecks pass, and the library builds on all TFMs.

Ports BITRANGEINTARRAY, set-member expiry (SADDEX, S[P]EXPIRE[AT], SPTTL,
SPEXPIRETIME, SPERSIST), BLESS and ZMOVE/ZMOVEMEMBER onto the v4 core as
group methods (Bitmaps.PositionsAsync, Sets.AddWithExpiryAsync /
ExpireAsync / PersistAsync / GetTimeToLiveAsync / GetExpireDateTimeAsync,
Keys.BlessAsync / UnblessAsync / BlessFlagsAsync, SortedSets.MoveAsync /
MoveByScoreAsync / MoveMembersAsync), with main's IDatabase/IServer
signatures delegating to them, plus CommandTrace.CpuTime, BlessFlags,
the RedisFeatures/KeyNotificationType additions and SER011.

Round-trip and reply tests move to the v4 harness with main's bytes;
the new commands get retry categories, which v4 requires of every command.
@mgravell
mgravell merged commit 7a81a7e into v4 Dec 3, 2026
3 checks passed
@mgravell
mgravell deleted the marc/v4-absorb-3343 branch December 3, 2026 21:27
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