Skip to content

Pull from upstream - #1

Open
deepakverma wants to merge 513 commits into
deepakverma:mainfrom
StackExchange:main
Open

Pull from upstream#1
deepakverma wants to merge 513 commits into
deepakverma:mainfrom
StackExchange:main

Conversation

@deepakverma

Copy link
Copy Markdown
Owner

No description provided.

slorello89 and others added 30 commits December 21, 2023 15:04
* honor select disposition in transactions

* rearranging if/switch

* using server instead of multiplxer

* release notes
Co-authored-by: Nick Craver <nrcraver@gmail.com>
This adds a bit of null ref handling (few ifs). Fixes #2576.

Overall, this is biting people in the shutdown race, more likely under load, so let's eat the if checks here to prevent it. I decided to go with the specific approach here as to not affect inlining.
* fix #2642

1: don't treat trivial clusters as clusters - Alibaba uses this config
2: report synchronous failures immidiately and accurately

* instead of using node count, use explicit tracking of the DB count

* release notes
* fix #2653

* Update src/StackExchange.Redis/ServerEndPoint.cs

Co-authored-by: Philo <philon@microsoft.com>

* release notes

* merge fail

---------

Co-authored-by: Philo <philon@microsoft.com>
This is a new feature for allowing keepalive commands to be sent every heartbeat regardless of if they're needed for actual keepalives. I've gotten a ping about a network drop that went undetected for ~8 minutes because of usage only in strings. We see this use case not uncommonly, and because of that string type being the only thing used, we don't detect a protocol fault from subsequent string commands.

The symptoms here are partial/unexpected string payloads but ultimately the wrong answers to the wrong query. Given we don't know at what layer this drop happens (this appears to be extremely rare, 1 in quadrillions as far as we know), the best we can currently do is react to it ASAP.

There may be a better way to accomplish what this is after - discussing with Marc soon as we're both online but prepping this PR in case it's best path.
* Support `HeartbeatConsistencyChecks` in `Clone()`
* include heartbeatInterval
#2659)

* add new AddLibraryNameSuffix API for annotating connections with usage

* fixup test

* new partial for lib-name bits

* use hashing rather than array shenanigans

* move to shipped; fix comment typo

* comment example

* reverse comment owner
* Provide new LoggingTunnel API; this

* words

* fix PR number

* fix file location

* save the sln

* identify smessage as out-of-band

* add .ForAwait() throughout LoggingTunnel

* clarify meaning of path parameter
This issue was brought to my attention last night (thanks to Badrish Chandramouli): dotnet/dotnet-api-docs#6660

This changeset ensures that we do not honor self-signed certs or partial/broken chains as a result of `X509VerificationFlags.AllowUnknownCertificateAuthority` downstream and adds a few tests and utilities to generate test certificates (currently valid for ~9000 days). Instead we are checking that the certificate we're being told to trust is explicitly in the chain, given that the result of `.Build()` cannot be trusted for this case.

This also resolves an issue where `TrustIssuer` could be called but we'd error when _no errors_ were detected (due to requiring chain errors in our validator), this means users couldn't temporarily trust a cert while getting it installed on the machine for instance and migrating between the 2 setups was difficult.

This needs careful eyes, please scrutinize heavily. It's possible this breaks an existing user, but...it should be broken if so unless there's a case I'm not seeing.
… dedicated thread (#2667)

Resolving #2664.

This went through a few iterations early on, but in the current form the issue is that we can await hop to a thread pool thread and have our wait blocking there - not awesome. We want to avoid that entirely and do a full sync path here.
Further hardening following #2665. This is an additional check to match the .NET implementation for TLS cert checks so that we don't treat a cert flagged as non-TLS-server effectively. This ensures that a certificate either doesn't have OIDs here (valid, backwards compatible) or has the server-certificate OID indicating it's valid for consumption over TLS for us.

Cheers @bartonjs for the report and info here.
…ss ambiguous alternatives (#2702)

Closes #2697.

All of the replacements were empirically tested to be correct via simple programs in combination with a local redis instance.

Notably, there is one worrying nit; in testing it turns out that the `IDatabase.List{Left,Right}Pop(RedisKey, long, CommandFlags)` overload which I talked about in the issue _can_ actually return null, contrary to its nullability annotations. This occurs on missing key; in that case redis replies

	Nil reply: if the key does not exist.

as per https://redis.io/docs/latest/commands/lpop/, which then at

https://github.com/StackExchange/StackExchange.Redis/blob/cb8b20df0e2975717bde97ce95ac20e8e8353572/src/StackExchange.Redis/ResultProcessor.cs#L1546-L1547

and later at

https://github.com/StackExchange/StackExchange.Redis/blob/cb8b20df0e2975717bde97ce95ac20e8e8353572/src/StackExchange.Redis/ExtensionMethods.cs#L339-L341

turns into a `null`.

I briefly attempted to rectify this, but the `RedisValueArrayProcessor` poses a problem here, as changing it to derive
`ResultProcessor<RedisValue[]?>` causes the solution to light up in red, and I'd rather not mess with that as a first contribution without at least prior discussion concerning direction there.
* support reading from last message from stream with xread

* recover previous formatting

* add redisversion and use it in integration tests
* initial implementation of #2706

* build: net8 compat

* Docs: add HighIntegrity initial docs

* PR fixups

* Options fixes

* Update tests/StackExchange.Redis.Tests/TestBase.cs

* add tests that result boxes / continuations work correctly for high-integrity-mode

* - switch to counter rather than entropy
- add transaction work to basic tests, to ensure handled

* naming is hard

* - add explicit connection failure type
- burn the connection on failure
- add initial metrics

* benchmark impact of high performance mode

* be more flexible in HeartbeatConsistencyCheckPingsAsync

* add config tests

---------

Co-authored-by: Nick Craver <nickcraver@microsoft.com>
Co-authored-by: Nick Craver <nrcraver@gmail.com>
Closes/Fixes #2738

this is just to move the integration test against to newer version of Redis
mgravell and others added 6 commits June 23, 2026 11:32
* - introduce CycleBufferPool as a concept that encapsulates MemoryPool<byte> with the growth logic
- support `-d` in the benchmark

* - add ConfigurationOptions support
- add [SkipLocalsInit] to RESPite

* add ResponseArrayPool (#3104)

* add ResponseArrayPool

* Lease

* IMemoryOwner<byte>?

---------

Co-authored-by: ITikhonov <ITikhonov@lanit.ru>

* refactor API so that MemoryPool<T> can be used throughout, and shared between lease and cycle-buffers

* we don't actually need a default CycleBufferPool<T> impl;

* fix typo

* avoid `Failed` nomenclature in tests - makes it hard to isolate CI problems

---------

Co-authored-by: Ivan Tikhonov <pairbit@gmail.com>
Co-authored-by: ITikhonov <ITikhonov@lanit.ru>
Updated release notes for version 2.13.17 with fixes and enhancements.
* move KeyIdle[Async]Tests to a server without replication

* stabilize Windows CI

* don't run the `OBJECT IDLETIME` tests in WSL

* skip sentinel tests on Windows CI
pairbit and others added 23 commits June 25, 2026 15:55
* Merge pull request #4 from pairbit/RedisValueSequence

Redis value sequence

* fix order

* fix

* PublicAPI.Unshipped

* GetCharCount and GetMaxCharCount

* add checking OverflowException

* comment SequenceCompareTo

* implement StartsWith

* fix StartsWith

* refact

* GetHashCode

* add Equals, CompareTo, StartsWith for ByteArray or MemoryManager

* add ReadOnlySequenceIterator

* refac

* - GetHashCode
- GetChars/GetCharCount
- Simplify
- normalize .First.Span

* TryParse

* mark WriteUnifiedSequence(ROS) as redundant for now (and fix 64-bit length)

* CompareTo

* add integration test (and fix CI)

* polishing

* avoid the string alloc in GetHashCode (when possible)

---------

Co-authored-by: ITikhonov <ITikhonov@lanit.ru>
Co-authored-by: Marc Gravell <marc.gravell@gmail.com>
…ShortBlob storage kind (#3114)

* spike better RedisValue parsing logic

* Introduce new storage kind for small payloads (<=8 bytes) - avoids array alloc

* fix CI

* CI: tweak failing test

* tidying (support ulong as canonical)
* investigate and fix #3123

* F+F the test setup

* nit, nuke a using direction

* in debug: make all string -> RedisValue *explicit* (incomplete, needs a fix to the ship-file)

* fix shipfiles for DEBUG hack

* docs

* fix exp link

* I knew we had a Write...(RedisKey) method somewhere!

* move NO ONE to RedisLiterals
…) (#3121)

Replaces the per-method 'int indent + local NewLine()' pattern in
AsciiHashGenerator with a small builder-style CodeWriter wrapping the
existing StringBuilder, per the second sketch in #3033. Generated
output is byte-for-byte identical.
* propose agents guidelines and skills

* add command source notes

* ensure `SORT_RO` parse correctly; impact: Execute would not apply command-map rename correctly otherwise

* Update AGENTS.md
* Throw a clear error when an Execute command contains whitespace

Execute("ACL SETUSER x") passes a whole command line as the single command
token, which gets sent as one unknown command and comes back as an opaque
server error. Since a redis command token never contains internal whitespace,
this is always a caller mistake, so the ExecuteMessage constructor now fails
fast with an ArgumentException-style RedisCommandException that names the
offending command and shows the correct token-per-argument form. Resolves #2689.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>

* test for simple space only

limit to simple space; if people are being *that* creative, that's on them

* Remove test case for 'echo\thello' command

Removed test case for command with tab character.

---------

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Co-authored-by: Marc Gravell <marc.gravell@gmail.com>
#3129)

* fix #3127 fix #3128 allow reasonable CLIENT commands to proceed without admin mode enabled

* comments
* initial cut

* transactions

* iteration/evolution

* docs

* refactored API based on internal conversations

* more docs

* WIP

* clarify MULTI/EXEC logic

* avoid value-tuple
* fix: Queue batch commands to backlog during MOVED reconnection

When a MOVED-to-same-endpoint triggers reconnection (PR #3003), batch
commands issued during the ~50-100ms reconnection window fail immediately
with NoConnectionAvailable. This is because:

1. RedisBatch.Execute() calls SelectServer() which returns null for
   disconnected/reconnecting servers.
2. PhysicalBridge.TryEnqueue() returns false when !IsConnected, unlike
   TryWriteAsync/TryWriteSync which queue to the backlog.

This creates an inconsistency where individual async commands succeed
(queued via BacklogPolicy) but batch commands throw during the same
reconnection window.

Fix:
- RedisBatch.Execute(): When SelectServer returns null and
  BacklogPolicy.QueueWhileDisconnected is enabled, retry with
  allowDisconnected=true to find the server endpoint.
- PhysicalBridge.TryEnqueue(): When disconnected/reconnecting and
  BacklogPolicy.QueueWhileDisconnected is enabled, queue messages to
  the backlog instead of returning false.

This matches the existing behavior of individual command paths and
ensures batch commands are transparently queued and sent after
reconnection completes.

Tested with proxy redirect scenario (MOVED-to-same-endpoint + disconnect):
- Before: 1-3 NoConnectionAvailable errors per MOVED redirect
- After: 0 errors, batch waits for reconnection via backlog

* test: Add batch backlog tests for MOVED-triggered reconnection

Add two integration tests verifying batch commands are queued to the
backlog during MOVED-to-same-endpoint reconnection:

- MovedToSameEndpoint_BatchCommands_QueuedDuringReconnect: Verifies
  that a batch containing a MOVED-triggering command completes
  successfully after reconnection (commands queued to backlog).

- MovedToSameEndpoint_SubsequentBatch_QueuedDuringReconnect: Verifies
  that a second batch issued during the reconnection window is queued
  rather than throwing NoConnectionAvailable (fire-and-forget scenario).

---------

Co-authored-by: advaMosh <advaMosh@users.noreply.github.com>
…es (#3130)

SwitchPrimary only reconfigured when the new primary was an unknown
endpoint. On an in-place failover (old master demoted, replica promoted),
the new master is already in `servers`, so it no-op'd and the client kept
writing to the demoted node until restart.

Reconfigure with reconfigureAll:true when a known primary's cached role is
stale, so connected nodes re-read their role before re-election. Also move
the switch reconfigure out of the sentinelConnectionChildren lock.

Refs #1891
* LMOVEM

* test CI image available

* SUNIONCARD/SDIFFCARD

* XREAD/XREADGROUP MAXCOUNT/MAXSIZE

* cleanup unshipped

* fixup test versions
We hand-start every server instance the tests need, so drop a policy-rc.d
that tells invoke-rc.d/deb-systemd-invoke not to start services at all. The
packaged redis-server unit would otherwise race our own primary for
127.0.0.1:6379 on any run where WSL came up with systemd.

That also sidesteps an install hang we saw with the 8.10.0 package: its
redis.conf lost "supervised auto", so redis never sd_notify()s, the
Type=notify unit never leaves "activating", and the postinst's
"systemctl start" blocks (indefinitely, since redis then can't save its RDB
on SIGTERM and the unit disables the stop timeout). That is an upstream
packaging slip which they are already fixing, so this isn't a permanent
change in behaviour from 8.10 - but not starting the service is the right
thing for this job regardless.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This PR is best summarised by docs/Failover.md
Point directly to GitHub releases to save a click.
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.