Repository navigation
v4: absorb main 3.5.0, part 10 - Redis 8.12 commands (#3343) - #3414
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports main #3343 (the Redis 8.12 commands, SER011) onto the v4 core.
Taken from main unchanged:
IDatabase/IDatabaseAsync/IServersurface, with main's exact signatures:StringBitPositions, theExpirationoverloads ofSetAdd,SetMemberExpire/GetTimeToLive/GetExpireDateTime/Persist,KeyBless/KeyUnbless/KeyBlessFlags,IServer.BlessedKeys, andSortedSetMove/MoveByScore/MoveMembers. AlsoBlessFlags,CommandTrace.CpuTime, theRedisFeaturesandKeyNotificationTypeadditions, and theRedisCommand/CommandMapentries.BYTEomitted,COUNTonly when given (always forBLESS SCAN), an empty member list sent asMEMBERS 0for the server to reject, andBLESS SET/CLEARraised to the primary.docs/exp/SER011.md, the coverage ledger, theTransactionAnalyzernote, the plans undernotes/, and the live tests (BitTests,BlessTests,SetMemberExpiryTests,SortedSetMoveTests).Rewritten for v4. Every command is a group method, and the
IDatabasemembers delegate to them:Bitmaps.PositionsAsync(key, bit, start = 0, end = -1, indexType = Byte, limit = null), returningReadOnlyLease<long>.Sets.AddWithExpiryAsync(key, value | values, Expiration expiry, When when = Always), returningbool. It's named apart fromAddAsyncfor the reasonHashes.SetWithExpiryAsyncis:SADDcounts new members,SADDEXsays whether the write happened.Sets.ExpireAsync(key, members, Expiration expiry, ExpireWhen when = Always), plusPersistAsync,GetTimeToLiveAsyncandGetExpireDateTimeAsync, each returning a lease. As inHashes.ExpireAsync, theExpirationpicks betweenSEXPIRE,SPEXPIRE,SEXPIREATandSPEXPIREAT, so main's twoTimeSpan/DateTimeoverloads are one method here.KeepTtlandPersistare refused.SPTTLis never client-cached.Keys.BlessAsync/UnblessAsync(key, BlessFlags bless)andKeys.BlessFlagsAsync(key).SortedSets.MoveAsync(source, destination, order = Ascending, count = null),MoveByScoreAsync(source, destination, start, stop, exclude = None, count = null)andMoveMembersAsync(source, destination, members, when = Always). Each returnsReadOnlyLease<SortedSetEntry>?, which is null when nothing moved.*Arraysiblings serve theIDatabasearrays.IServer.BlessedKeysis aRespScanEnumerableoverBLESS SCAN, using theSCANpage handler. All group methods are[Experimental(SER011)].Small differences from main:
[member, score]run as RESP2 pairs.BITRANGEINTARRAYare read-only,SPERSISTis checked, andSADDEXand the member expire commands are last-wins (MNX/MXXandNX/XX/GT/LTare raised to checked, as for hashes). Main has no such check, so it left these out.KeyPrefixed*changes and its tests, because v4 has noKeyspaceIsolationwrappers. I also left out the unusedRedisLiteralsadditions; the tokens areRespLiteralshere.Tests. The round-trip and reply tests now go through v4's harness:
RoundTrip.ExecuteAsyncwith theIDatabasecall, and the group handlers directly. The cases and bytes are main's.Server812GroupRoundTripadds coverage of the lease-returning group forms.Testing:
CommandTraceParse,KeyNotificationUnitTests): 329/329 on net10.0. SwappingNX/XXinMoveMembersCommandfails 2.BitTests,BlessTests,SetMemberExpiryTests,SortedSetMoveTestsandScanTestswere run against a standaloneclient-libs-test:8.12.0container: 148 passed, 12 skipped. The 2 failures were the cluster-onlySortedSetMoveTests.Cluster_SameSlot_RoutesAndMoves, which ran on that same old build in the cluster and failed on the unknown command.RespAggregateProtoTests.ADeferredWalkNeedsNoStorageAtAllandRespAggregateTimingTests.ADeferredWalkAgainstMaterialiseThenRead. They are allocation and timing tests, and both pass 3/3 in isolation.