Repository navigation
Fix pg reconnect inside a transaction, mysql2 closed client after Async stop, SQLite hash rows - #52
Merged
Conversation
…d Async task on mysql2 and SQLite hash rows Co-Authored-By: Doron Eli Rachman <doron050@gmail.com>
…interrupted query, SQLite results_as_hash rows; reject SQLite parameters sqlc does not report Co-Authored-By: Doron Eli Rachman <doron050@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
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
Fixes the three bugs found by the third pre-release check. Each fix comes after an E2E test that fails on
main:transactionwas reconnected mid-transaction.PG::ConnectionBad), the next call ranclient.resetand the rest ofthe block autocommitted on a new session.
transactionthen returned normally: the server had rolled backeverything before the loss, while everything after it was committed.
ConnectionState#in_transactionis set whiletransactionruns.with_clientraisesPG::ConnectionBadinstead of reconnecting, andtransactionraisesPG::ConnectionBad("transaction rolledback: the connection was lost") instead of sending
COMMIT. The connection is reconnected on the next checkout.test_connection_lost_inside_transaction_is_not_reconnected_until_the_transaction_ends.Asynctask during a query left a closed client in the pool.with_clientonly discarded closedclients on
Mysql2::Error. AfterAsync::StoporThread#raise, the next unrelated call failed with "MySQLclient is not connected".
ROLLBACKon such a client no longer replacesthe original exception.
test_a_stopped_async_task_does_not_leave_a_closed_connection_in_the_pool(plain call and insidetransaction).SQLite3::Databaseopened withresults_as_hash: truereturned all-nilrows.execute_statementhelper that always builds an arraySQLite3::ResultSet(the same steps as
Statement#execute), and the database's setting is left untouched.test_a_database_returning_hash_rows_still_builds_rows(:execlastid,:one,sqlc.embed,:batchone).ON CONFLICT ... DO UPDATE SET: it either leavessqlc.arg(...)inthe SQL, or reports fewer parameters than there are
?. In the second case the method silently boundNULL.sqlc.*macro, and placeholders without a reported parameter, with a hint touse
excluded.<column>. String literals and comments are ignored.test_sqlite_parameters_sqlc_does_not_report_are_generation_errorsandtest_sqlite_placeholders_in_literals_and_comments_are_not_parameters. The synthetic golden queries withoutparameters no longer contain a bare
?.README (connections, transactions, limitations) and
docs/Coverage.mdare updated.steep_expectations.ymlisrefreshed: it gains new
PG/SQLite3constant references and drops oneMysql2reference.Checklist
examples/is regenerated (rake sqlc_generate_process) and committedrake test, andrake end2end_*when the generated code changes)rake rubocop) and Steep-clean (rake steep)bug,enhancement,documentation, orbreaking) so the release notes are grouped correctly