Skip to content

Retry queries only before sending - #467

Open
ruslandoga wants to merge 14 commits into
masterfrom
rd/project-bugs-improvements-review
Open

ruslandoga wants to merge 14 commits into
masterfrom
rd/project-bugs-improvements-review

Conversation

@ruslandoga

@ruslandoga ruslandoga commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

A completed INSERT could be silently repeated when its successful HTTP response was lost. Ch now returns connection errors without replaying any query once sending starts. A lost INSERT acknowledgement leaves exactly one stored row.

Before sending a new request, check open? and probe idle connections with recv(conn, 0, 0). Failures request a reconnect and retry through DBConnection, which retains ownership of the connection lifecycle. A zero-timeout result continues on the same healthy connection. Stream continuations bypass the probe.

Require Mint ~> 1.11 and lock 1.11.0, which keeps healthy connections open when the probe times out. Ordinary, Enumerable, and Collectable INSERT failures cannot replay a write or retry a chunk against an obsolete request reference. Cursor declaration failures return DBConnection's supported non-retry disconnect result. Queries using an existing DBConnection.run/3 connection return errors without automatically switching connections.

Validation:

  • Regression coverage for committed INSERTs with dropped acknowledgements, stale-idle recovery before an INSERT, stream continuation failures, and read response timeouts or closes without replay.
  • Full CI matrix passed, including Elixir 1.15 / OTP 25 and latest versions with Dialyzer and lint.
  • Focused retry/fault tests: 34 passed.
  • Warnings-as-errors compilation, formatting, spelling, Dialyzer, and git diff --check passed.

Fixes #442.
Fixes #450.
Related: #304, #444, and Mint #486.

@ruslandoga ruslandoga changed the title Avoid replaying writes after connection failures Retry queries only before sending Oct 12, 2026
@ruslandoga
ruslandoga force-pushed the rd/project-bugs-improvements-review branch from 2a99023 to 9074888 Compare October 12, 2026 14:04

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant