Optimize single-node master/replica reads#3758
Merged
a-TODO-rov merged 2 commits intoMay 20, 2026
Merged
Conversation
Contributor
Author
|
Local validation on head
Hosted PR checks currently show no failures; only Cursor Bugbot and Jit Security are configured on this PR. |
Contributor
|
Thanks @Sean-Kenneth-Doherty |
Collaborator
|
hey, seems pretty good to me. |
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.
Summary
ReadFromresolves to exactly one nodeFluxchain on the single-node hot pathFixes #3744.
Verification
~/.local/share/mise/installs/maven/3.9.11/apache-maven-3.9.11/bin/mvn -Dtest=io.lettuce.core.masterreplica.MasterReplicaConnectionProviderUnitTests testNote:
mvnvia the mise shim was not configured in this shell, so I used the installed Maven 3.9.11 binary directly.Note
Low Risk
Low risk behavioral change limited to
ReadFromread selection when it resolves to a single node; it mainly skips Reactor assembly andisOpenfiltering, with a unit test covering the new path.Overview
Optimizes master/replica read connection selection by short-circuiting when
ReadFromresolves to exactly one node, returning that node’s connection directly instead of building a ReactorFluxchain.This removes the redundant single-node
isOpen/fallback logic from the reactive selection path and adds a unit test (shouldUseDirectConnectionForSingleReadSelection) to assert the direct-connection behavior (and thatisOpen()is not consulted).Reviewed by Cursor Bugbot for commit a3e582e. Bugbot is set up for automated code reviews on this repo. Configure here.