feat: auto-rebuild prepared statement on server-side loss - #11
Merged
Conversation
JimMoen
commented
Jul 14, 2026
Contributor
- Store SQL and auto_rebuild flag in PreparedStatementResource
- Accept auto_rebuild boolean in Rust NIF prepare()
- Detect prepared statement loss via tonic Status::NotFound in error chain
- Auto-recreate prepared statement and retry execute on loss when auto_rebuild is set
- Add prepare/3 to Erlang API accepting #{auto_rebuild => boolean()} opts
- Keep backward-compatible prepare/2 with auto_rebuild defaulting to false
- Store SQL and auto_rebuild flag in PreparedStatementResource
- Accept auto_rebuild boolean in Rust NIF prepare()
- Detect prepared statement loss via tonic Status::NotFound in error chain
- Auto-recreate prepared statement and retry execute on loss when auto_rebuild is set
- Add prepare/3 to Erlang API accepting #{auto_rebuild => boolean()} opts
- Keep backward-compatible prepare/2 with auto_rebuild defaulting to false
When close_prepared sets inner to None, execute_prepare previously returned 'client_or_statement_stopped' before checking auto_rebuild. Now handles both cases: 1. inner is Some but server returns NOT_FOUND (gRPC path) 2. inner is None (already closed locally) when auto_rebuild=true Extracted try_rebuild_and_execute as a helper function.
t_prepare_auto_rebuild_test: close prepared then execute - auto-rebuild and succeed t_prepare_no_rebuild_test: close prepared then execute - return error without rebuild
JimMoen
force-pushed
the
fix/auto-rebuild-prepared
branch
from
July 20, 2026 06:55
514a0e5 to
fe73ea1
Compare
Runs every Monday at 04:00 UTC, also triggerable via workflow_dispatch.
zmstone
approved these changes
Jul 20, 2026
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.