| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…mmit The HTTP and WebSocket APIs reported the statement that ends an implicit transaction as successful before committing the transaction. When the commit then failed, the client saw the success followed by an extra error, and the request continued with its next query, although the write never became durable. Commit before building the result of the statement that ends its group, for statements with and without rows, so that a commit failure replaces the statement's success and stops the request. This matches the HTTP API docs and the order of PostgreSQL's simple query protocol. Parameters the commit reverts are now reported with the statement, except on HTTP results with rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test makes the implicit commit of an INSERT fail deterministically: a failpoint callback parks the INSERT after it packed its rows, the table gains a column, and the resumed INSERT's commit fails. It checks that the commit error is the only result of the statement that ends the implicit transaction, on HTTP and WebSocket, for Extended requests and for Simple requests that end in a SELECT, and that no rows land. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
Motivation
The HTTP (/api/sql) and WebSocket (/api/experimental/sql) APIs report the statement that ends an implicit transaction as successful before they commit that transaction. If the commit then fails, the client receives the statement's success, then an extra error, and the request continues with its next query, although the write never became durable.
Reproduced on v26.44.0 with a failpoint and a concurrent ALTER TABLE: the Extended request [INSERT INTO t VALUES (100), SELECT 1] returned [{"ok": "INSERT 0 1"}, {"error": {"code": "40001", ...}}, {"tag": "SELECT 1", ...}], three results for two queries, and t stayed empty. The HTTP API docs promise the opposite: the request stops at the first error, and each committed statement returns exactly one value. Writes that stage their rows until the commit are affected, for example a constant INSERT ... VALUES.
Found while working on CNS-170 (server-side execution time for the Console), where the early success also stops a client's timer before the commit.
Description
Best reviewed commit by commit:
User-visible effect: the HTTP and WebSocket SQL APIs no longer report a write as successful when its transaction fails to commit. The commit error becomes that statement's result, and the request stops.
Verification
Alternatives
🤖 Generated with Claude Code