feat: partial sharding support for PREPARE and EXECUTE - #1368
Open
levkk wants to merge 19 commits into
Open
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
levkk
marked this pull request as ready for review
August 16, 2026 20:03
This was referenced Aug 17, 2026
levkk
force-pushed
the
levkk-prepared-simple-routing
branch
from
August 17, 2026 18:48
e2e9044 to
ebcc0c7
Compare
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.
Prepared statements
Correctly store statements sent with
PREPAREin the global cache. We use the whole query string with data type specifications as key, while anonymizing the statement name. This is equivalent to usingParseas cache key.becomes
It's then dynamically rewritten to
at execution time.
This is because it's kinda hard to parse the data types out of the string and we need a unique key identifying the prepared statement in the cache.
Sharding
Handle
EXECUTEby extracting parameters and passing them to our query router. This works with I think most of our sharding features, i.e., direct-to-shard and cross-shard queries.TODOs
Notes for reviewers
client/prepared_statementsmodule is from moving stuff around. There is some diff for handlingPREPARE, that's where I would focus the review.Servernow get processed through the server state machine; this was necessary for correct state management for handlingPREPAREstatements; seems to have no bad side effects.