`lex.IsStartTxn(query)` is not strict enough to assert the trasaction status
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 73
- Forks
- 41
- Avg merge
- 21h 3m
- Merged PRs (30d)
- 21
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
- Connect through TiProxy and start a transaction.
- Execute a write but do not commit it.
- Cause the router to request redirection of this connection.
- Send
BEGIN garbageas a normalCOM_QUERY. - Observe the syntax error, then issue
ROLLBACKand query the written row.
It's because an invalid BEGIN actually does nothing, but TiProxy thought it might commit and start a new transaction.
2. What did you expect to see? (Required)
The invalid statement should return a syntax error without changing the active transaction; ROLLBACK should undo the earlier write.
3. What did you see instead (Required)
TiProxy matches only the leading BEGIN token, sends an internal COMMIT to the old backend, attempts redirection, and then forwards the invalid SQL. The client sees only the syntax error, but the earlier write is already committed.
4. What is your version? (Required)
- TiProxy source commit:
51859ee68000dd14dbff4dcaf0ffaeb349d1d5be
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at lex.IsStartTxn(query) and trace how TiProxy handles a COM_QUERY beginning with BEGIN during connection redirection. Reproduce the BEGIN garbage sequence, then verify that only a valid transaction-start statement triggers the internal commit and that ROLLBACK still undoes the earlier write.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend-api-design, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100