Optimize single-node master/replica reads#3758
Open
Sean-Kenneth-Doherty wants to merge 1 commit into
Open
Conversation
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 |
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: small performance-oriented change to the READ connection selection path plus a unit test; behavior only differs by skipping the open-filter/Flux pipeline when exactly one node is selected.
Overview
Optimizes master/replica READ connection selection by short-circuiting to a direct connection when
ReadFromresolves to exactly one node, avoiding construction/subscription of the ReactorFluxchain.Updates the selection logic to only use the order-sensitive
isOpenfiltering path for multi-node selections, and adds a unit test ensuring the single-node path returns the connection directly without callingisOpen().Reviewed by Cursor Bugbot for commit 7a4a162. Bugbot is set up for automated code reviews on this repo. Configure here.